diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-03-30 18:44:39 (GMT) |
---|---|---|
committer | Bjoern Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-04-07 13:51:08 (GMT) |
commit | 6f93983dcce291f66d42e844f1d12bd4a59b046b (patch) | |
tree | e9d7e121bcb3142c7cc61c56ff4277083842c3f8 /src/gui/painting/qtransform.h | |
parent | fde7f3d03782c801901f511131458d6fcb1021a5 (diff) | |
download | Qt-6f93983dcce291f66d42e844f1d12bd4a59b046b.zip Qt-6f93983dcce291f66d42e844f1d12bd4a59b046b.tar.gz Qt-6f93983dcce291f66d42e844f1d12bd4a59b046b.tar.bz2 |
Optimise QMatrix and QTransform
Add some private inline constructors and do inlining
other places.
All test still pass.
Diffstat (limited to 'src/gui/painting/qtransform.h')
-rw-r--r-- | src/gui/painting/qtransform.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index c76409b..2d6c889 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -159,6 +159,19 @@ public: static QTransform fromScale(qreal dx, qreal dy); private: + inline QTransform(qreal h11, qreal h12, qreal h13, + qreal h21, qreal h22, qreal h23, + qreal h31, qreal h32, qreal h33, bool) + : affine(h11, h12, h21, h22, h31, h32, true) + , m_13(h13), m_23(h23), m_33(h33) + , m_type(TxNone) + , m_dirty(TxProject) {} + inline QTransform(bool) + : affine(true) + , m_13(0), m_23(0), m_33(1) + , m_type(TxNone) + , m_dirty(TxNone) {} + inline TransformationType inline_type() const; QMatrix affine; qreal m_13; qreal m_23; @@ -173,18 +186,25 @@ private: Q_DECLARE_TYPEINFO(QTransform, Q_MOVABLE_TYPE); /******* inlines *****/ +inline QTransform::TransformationType QTransform::inline_type() const +{ + if (m_dirty == TxNone) + return static_cast<TransformationType>(m_type); + return type(); +} + inline bool QTransform::isAffine() const { - return type() < TxProject; + return inline_type() < TxProject; } inline bool QTransform::isIdentity() const { - return type() == TxNone; + return inline_type() == TxNone; } inline bool QTransform::isInvertible() const { - return !qFuzzyCompare(determinant() + 1, 1); + return !qIsFuzzyNull(determinant()); } inline bool QTransform::isScaling() const @@ -193,12 +213,12 @@ inline bool QTransform::isScaling() const } inline bool QTransform::isRotating() const { - return type() >= TxRotate; + return inline_type() >= TxRotate; } inline bool QTransform::isTranslating() const { - return type() >= TxTranslate; + return inline_type() >= TxTranslate; } inline qreal QTransform::determinant() const |