Changeset 561 for trunk/src/gui/painting/qbezier.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/painting/qbezier.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 128 128 129 129 qreal normalized = qSqrt(dx * dx + dy * dy); 130 if (qFuzzy Compare(normalized + 1, 1))130 if (qFuzzyIsNull(normalized)) 131 131 break; 132 132 … … 134 134 135 135 qreal t = qSqrt(4. / 3. * normalized * flatness / d); 136 if (t > 1 || qFuzzy Compare(t,(qreal)1.))136 if (t > 1 || qFuzzyIsNull(t - (qreal)1.)) 137 137 break; 138 138 bez.parameterSplitLeft(t, &left); … … 145 145 qreal *x1, qreal *x2) 146 146 { 147 if (qFuzzy Compare(a + 1, 1)) {148 if (qFuzzy Compare(b + 1, 1))147 if (qFuzzyIsNull(a)) { 148 if (qFuzzyIsNull(b)) 149 149 return 0; 150 150 *x1 = *x2 = (-c / b); … … 152 152 } else { 153 153 const qreal det = b * b - 4 * a * c; 154 if (qFuzzy Compare(det + 1, 1)) {154 if (qFuzzyIsNull(det)) { 155 155 *x1 = *x2 = -b / (2 * a); 156 156 return 1; 157 157 } 158 158 if (det > 0) { 159 if (qFuzzy Compare(b + 1, 1)) {159 if (qFuzzyIsNull(b)) { 160 160 *x2 = qSqrt(-c / a); 161 161 *x1 = -(*x2); … … 188 188 *t2 = r1; 189 189 } 190 if (!qFuzzy Compare(a + 1, 1))190 if (!qFuzzyIsNull(a)) 191 191 *tCups = 0.5 * (-b / a); 192 192 else … … 244 244 qreal c = 2 * (by * cx - bx * cy); 245 245 246 if ((qFuzzy Compare(a + 1, 1) && qFuzzyCompare(b + 1, 1)) ||246 if ((qFuzzyIsNull(a) && qFuzzyIsNull(b)) || 247 247 (b * b - 4 * a *c) < 0) { 248 248 QBezier bez(*this); … … 448 448 + prev_normal.y() * next_normal.y(); 449 449 450 if (qFuzzy Compare(r + 1, 1)) {450 if (qFuzzyIsNull(r)) { 451 451 points_shifted[i] = points[i] + offset * prev_normal; 452 452 } else { … … 478 478 normals[0] = QPointF(b->y2 - b->y1, b->x1 - b->x2); 479 479 qreal dist = qSqrt(normals[0].x()*normals[0].x() + normals[0].y()*normals[0].y()); 480 if (qFuzzy Compare(dist + 1, 1))480 if (qFuzzyIsNull(dist)) 481 481 return false; 482 482 normals[0] /= dist; 483 483 normals[2] = QPointF(b->y4 - b->y3, b->x3 - b->x4); 484 484 dist = qSqrt(normals[2].x()*normals[2].x() + normals[2].y()*normals[2].y()); 485 if (qFuzzy Compare(dist + 1, 1))485 if (qFuzzyIsNull(dist)) 486 486 return false; 487 487 normals[2] /= dist; … … 498 498 if (cos_a < -1.) 499 499 cos_a = -1; 500 angles[i] = acos(cos_a)/Q_PI;500 angles[i] = qAcos(cos_a)/Q_PI; 501 501 } 502 502 … … 674 674 static QDebug operator<<(QDebug dbg, const QBezier &bz) 675 675 { 676 dbg << "["<<bz.x1<<", "<<bz.y1<<"], "677 << "["<<bz.x2<<", "<<bz.y2<<"], "678 << "["<<bz.x3<<", "<<bz.y3<<"], "679 << "["<<bz.x4<<", "<<bz.y4<<"]";676 dbg << '[' << bz.x1<< ", " << bz.y1 << "], " 677 << '[' << bz.x2 <<", " << bz.y2 << "], " 678 << '[' << bz.x3 <<", " << bz.y3 << "], " 679 << '[' << bz.x4 <<", " << bz.y4 << ']'; 680 680 return dbg; 681 681 } … … 817 817 { 818 818 if (IntersectBB(a, b)) { 819 QPointF la1( fabs((a.x3 - a.x2) - (a.x2 - a.x1)),820 fabs((a.y3 - a.y2) - (a.y2 - a.y1)));821 QPointF la2( fabs((a.x4 - a.x3) - (a.x3 - a.x2)),822 fabs((a.y4 - a.y3) - (a.y3 - a.y2)));819 QPointF la1(qFabs((a.x3 - a.x2) - (a.x2 - a.x1)), 820 qFabs((a.y3 - a.y2) - (a.y2 - a.y1))); 821 QPointF la2(qFabs((a.x4 - a.x3) - (a.x3 - a.x2)), 822 qFabs((a.y4 - a.y3) - (a.y3 - a.y2))); 823 823 QPointF la; 824 824 if (la1.x() > la2.x()) la.setX(la1.x()); else la.setX(la2.x()); 825 825 if (la1.y() > la2.y()) la.setY(la1.y()); else la.setY(la2.y()); 826 QPointF lb1( fabs((b.x3 - b.x2) - (b.x2 - b.x1)),827 fabs((b.y3 - b.y2) - (b.y2 - b.y1)));828 QPointF lb2( fabs((b.x4 - b.x3) - (b.x3 - b.x2)),829 fabs((b.y4 - b.y3) - (b.y3 - b.y2)));826 QPointF lb1(qFabs((b.x3 - b.x2) - (b.x2 - b.x1)), 827 qFabs((b.y3 - b.y2) - (b.y2 - b.y1))); 828 QPointF lb2(qFabs((b.x4 - b.x3) - (b.x3 - b.x2)), 829 qFabs((b.y4 - b.y3) - (b.y3 - b.y2))); 830 830 QPointF lb; 831 831 if (lb1.x() > lb2.x()) lb.setX(lb1.x()); else lb.setX(lb2.x()); … … 1023 1023 QList<qreal> result; 1024 1024 1025 if (qFuzzy Compare(reciprocal + 1, 1)) {1025 if (qFuzzyIsNull(reciprocal)) { 1026 1026 t0 = -b / (2 * a); 1027 1027 return 1; … … 1121 1121 1122 1122 qreal s4 = qAbs(6 * (ey * ax - ex * ay) / qSqrt(ex * ex + ey * ey)) + 0.00001f; 1123 qreal tf = pow(qreal(9 * flatness / s4), qreal(1./3.));1123 qreal tf = qPow(qreal(9 * flatness / s4), qreal(1./3.)); 1124 1124 *tMinus = t - (1 - t) * tf; 1125 1125 *tPlus = t + (1 - t) * tf;
Note:
See TracChangeset
for help on using the changeset viewer.