diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-06-02 19:02:42 (GMT) |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2009-06-15 11:00:00 (GMT) |
commit | b615be69f06a97aff3694065e97541133647d877 (patch) | |
tree | dc90aa08d31b6bdde2d534394311d3543a9e9981 /src/gui/painting/qmatrix.h | |
parent | 44766d265c16551043d2739171069fe042c40091 (diff) | |
download | Qt-b615be69f06a97aff3694065e97541133647d877.zip Qt-b615be69f06a97aff3694065e97541133647d877.tar.gz Qt-b615be69f06a97aff3694065e97541133647d877.tar.bz2 |
implement equality operator in a more sane way
Using qFuzzyCompare for checking whether two transformations
are equal doesn't give us too much and is inconsistent with
our other matrix classes. Using simple floating point
equality is a lot faster as well.
Added qFuzzyCompare overloads for QMatrix and QTransform to still
allow for fuzzy comparisons.
Reviewed-By: Samuel Rødal
Diffstat (limited to 'src/gui/painting/qmatrix.h')
-rw-r--r-- | src/gui/painting/qmatrix.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index 1df2395..4a4e91f 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -165,6 +165,17 @@ inline bool QMatrix::isIdentity() const && qFuzzyIsNull(_m21) && qFuzzyIsNull(_dx) && qFuzzyIsNull(_dy); } +inline bool qFuzzyCompare(const QMatrix& m1, const QMatrix& m2) +{ + return qFuzzyCompare(m1.m11(), m2.m11()) + && qFuzzyCompare(m1.m12(), m2.m12()) + && qFuzzyCompare(m1.m21(), m2.m21()) + && qFuzzyCompare(m1.m22(), m2.m22()) + && qFuzzyCompare(m1.dx(), m2.dx()) + && qFuzzyCompare(m1.dy(), m2.dy()); +} + + /***************************************************************************** QMatrix stream functions *****************************************************************************/ |