summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qmatrix.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-30 18:44:39 (GMT)
committerBjoern Erik Nilsen <bjorn.nilsen@nokia.com>2009-04-07 13:51:08 (GMT)
commit6f93983dcce291f66d42e844f1d12bd4a59b046b (patch)
treee9d7e121bcb3142c7cc61c56ff4277083842c3f8 /src/gui/painting/qmatrix.h
parentfde7f3d03782c801901f511131458d6fcb1021a5 (diff)
downloadQt-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/qmatrix.h')
-rw-r--r--src/gui/painting/qmatrix.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index bf53c32..1b6bd6d 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -121,6 +121,20 @@ public:
#endif
private:
+ inline QMatrix(bool)
+ : _m11(1.)
+ , _m12(0.)
+ , _m21(0.)
+ , _m22(1.)
+ , _dx(0.)
+ , _dy(0.) {}
+ inline QMatrix(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy, bool)
+ : _m11(m11)
+ , _m12(m12)
+ , _m21(m21)
+ , _m22(m22)
+ , _dx(dx)
+ , _dy(dy) {}
friend class QTransform;
qreal _m11, _m12;
qreal _m21, _m22;
@@ -147,8 +161,8 @@ Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m);
inline bool QMatrix::isIdentity() const
{
- return qFuzzyCompare(_m11, 1) && qFuzzyCompare(_m22, 1) && qFuzzyCompare(_m12 + 1, 1)
- && qFuzzyCompare(_m21 + 1, 1) && qFuzzyCompare(_dx + 1, 1) && qFuzzyCompare(_dy + 1, 1);
+ return qIsFuzzyNull(_m11 - 1) && qIsFuzzyNull(_m22 - 1) && qIsFuzzyNull(_m12)
+ && qIsFuzzyNull(_m21) && qIsFuzzyNull(_dx) && qIsFuzzyNull(_dy);
}
/*****************************************************************************