Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qbezier.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    128128
    129129        qreal normalized = qSqrt(dx * dx + dy * dy);
    130         if (qFuzzyCompare(normalized + 1, 1))
     130        if (qFuzzyIsNull(normalized))
    131131           break;
    132132
     
    134134
    135135        qreal t = qSqrt(4. / 3. * normalized * flatness / d);
    136         if (t > 1 || qFuzzyCompare(t, (qreal)1.))
     136        if (t > 1 || qFuzzyIsNull(t - (qreal)1.))
    137137            break;
    138138        bez.parameterSplitLeft(t, &left);
     
    145145                                 qreal *x1, qreal *x2)
    146146{
    147     if (qFuzzyCompare(a + 1, 1)) {
    148         if (qFuzzyCompare(b + 1, 1))
     147    if (qFuzzyIsNull(a)) {
     148        if (qFuzzyIsNull(b))
    149149            return 0;
    150150        *x1 = *x2 = (-c / b);
     
    152152    } else {
    153153        const qreal det = b * b - 4 * a * c;
    154         if (qFuzzyCompare(det + 1, 1)) {
     154        if (qFuzzyIsNull(det)) {
    155155            *x1 = *x2 = -b / (2 * a);
    156156            return 1;
    157157        }
    158158        if (det > 0) {
    159             if (qFuzzyCompare(b + 1, 1)) {
     159            if (qFuzzyIsNull(b)) {
    160160                *x2 = qSqrt(-c / a);
    161161                *x1 = -(*x2);
     
    188188            *t2 = r1;
    189189        }
    190         if (!qFuzzyCompare(a + 1, 1))
     190        if (!qFuzzyIsNull(a))
    191191            *tCups = 0.5 * (-b / a);
    192192        else
     
    244244    qreal c = 2 * (by * cx - bx * cy);
    245245
    246     if ((qFuzzyCompare(a + 1, 1) && qFuzzyCompare(b + 1, 1)) ||
     246    if ((qFuzzyIsNull(a) && qFuzzyIsNull(b)) ||
    247247        (b * b - 4 * a *c) < 0) {
    248248        QBezier bez(*this);
     
    448448                  + prev_normal.y() * next_normal.y();
    449449
    450         if (qFuzzyCompare(r + 1, 1)) {
     450        if (qFuzzyIsNull(r)) {
    451451            points_shifted[i] = points[i] + offset * prev_normal;
    452452        } else {
     
    478478    normals[0] = QPointF(b->y2 - b->y1, b->x1 - b->x2);
    479479    qreal dist = qSqrt(normals[0].x()*normals[0].x() + normals[0].y()*normals[0].y());
    480     if (qFuzzyCompare(dist + 1, 1))
     480    if (qFuzzyIsNull(dist))
    481481        return false;
    482482    normals[0] /= dist;
    483483    normals[2] = QPointF(b->y4 - b->y3, b->x3 - b->x4);
    484484    dist = qSqrt(normals[2].x()*normals[2].x() + normals[2].y()*normals[2].y());
    485     if (qFuzzyCompare(dist + 1, 1))
     485    if (qFuzzyIsNull(dist))
    486486        return false;
    487487    normals[2] /= dist;
     
    498498        if (cos_a < -1.)
    499499            cos_a = -1;
    500         angles[i] = acos(cos_a)/Q_PI;
     500        angles[i] = qAcos(cos_a)/Q_PI;
    501501    }
    502502
     
    674674static QDebug operator<<(QDebug dbg, const QBezier &bz)
    675675{
    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 << ']';
    680680    return dbg;
    681681}
     
    817817{
    818818    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)));
    823823        QPointF la;
    824824        if (la1.x() > la2.x()) la.setX(la1.x()); else la.setX(la2.x());
    825825        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)));
    830830        QPointF lb;
    831831        if (lb1.x() > lb2.x()) lb.setX(lb1.x()); else lb.setX(lb2.x());
     
    10231023    QList<qreal> result;
    10241024
    1025     if (qFuzzyCompare(reciprocal + 1, 1)) {
     1025    if (qFuzzyIsNull(reciprocal)) {
    10261026        t0 = -b / (2 * a);
    10271027        return 1;
     
    11211121
    11221122    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.));
    11241124    *tMinus = t - (1 - t) * tf;
    11251125    *tPlus  = t + (1 - t) * tf;
Note: See TracChangeset for help on using the changeset viewer.