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/qmatrix.h

    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**
     
    6262{
    6363public:
     64    inline explicit QMatrix(Qt::Initialization) {}
    6465    QMatrix();
    6566    QMatrix(qreal m11, qreal m12, qreal m21, qreal m22,
     
    100101    QMatrix &rotate(qreal a);
    101102
    102     bool isInvertible() const { return !qFuzzyCompare(_m11*_m22 - _m12*_m21 + 1, 1); }
    103     qreal det() const { return _m11*_m22 - _m12*_m21; }
     103    bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); }
     104    qreal determinant() const { return _m11*_m22 - _m12*_m21; }
     105#ifdef QT_DEPRECATED
     106    QT_DEPRECATED qreal det() const { return _m11*_m22 - _m12*_m21; }
     107#endif
    104108
    105109    QMatrix inverted(bool *invertible = 0) const;
     
    122126
    123127private:
     128    inline QMatrix(bool)
     129            : _m11(1.)
     130            , _m12(0.)
     131            , _m21(0.)
     132            , _m22(1.)
     133            , _dx(0.)
     134            , _dy(0.) {}
     135    inline QMatrix(qreal am11, qreal am12, qreal am21, qreal am22, qreal adx, qreal ady, bool)
     136            : _m11(am11)
     137            , _m12(am12)
     138            , _m21(am21)
     139            , _m22(am22)
     140            , _dx(adx)
     141            , _dy(ady) {}
    124142    friend class QTransform;
    125143    qreal _m11, _m12;
     
    148166inline bool QMatrix::isIdentity() const
    149167{
    150     return qFuzzyCompare(_m11, 1) && qFuzzyCompare(_m22, 1) && qFuzzyCompare(_m12 + 1, 1)
    151            && qFuzzyCompare(_m21 + 1, 1) && qFuzzyCompare(_dx + 1, 1) && qFuzzyCompare(_dy + 1, 1);
     168    return qFuzzyIsNull(_m11 - 1) && qFuzzyIsNull(_m22 - 1) && qFuzzyIsNull(_m12)
     169           && qFuzzyIsNull(_m21) && qFuzzyIsNull(_dx) && qFuzzyIsNull(_dy);
    152170}
     171
     172inline bool qFuzzyCompare(const QMatrix& m1, const QMatrix& m2)
     173{
     174    return qFuzzyCompare(m1.m11(), m2.m11())
     175        && qFuzzyCompare(m1.m12(), m2.m12())
     176        && qFuzzyCompare(m1.m21(), m2.m21())
     177        && qFuzzyCompare(m1.m22(), m2.m22())
     178        && qFuzzyCompare(m1.dx(), m2.dx())
     179        && qFuzzyCompare(m1.dy(), m2.dy());
     180}
     181
    153182
    154183/*****************************************************************************
     
    156185 *****************************************************************************/
    157186
     187#ifndef QT_NO_DATASTREAM
    158188Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix &);
    159189Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &);
     190#endif
    160191
    161192#ifndef QT_NO_DEBUG_STREAM
Note: See TracChangeset for help on using the changeset viewer.