From 6a408b6c6d00a76c74a4d612d85996d7ad3f03ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 12 Jun 2009 12:54:18 +0200 Subject: Fixed bug where QTransform::type() failed to compute the correct type. Since QTransform::type() now uses a switch based on m_dirty, we can't treat m_dirty as a bit mask anymore. Reviewed-by: Ariya --- src/gui/painting/qtransform.cpp | 15 ++++++++++----- tests/auto/qtransform/tst_qtransform.cpp | 7 +++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index c00012a..16d60f8 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -420,7 +420,8 @@ QTransform &QTransform::translate(qreal dx, qreal dy) affine._dy += dy*affine._m22 + dx*affine._m12; break; } - m_dirty |= TxTranslate; + if (m_dirty < TxTranslate) + m_dirty = TxTranslate; return *this; } @@ -472,7 +473,8 @@ QTransform & QTransform::scale(qreal sx, qreal sy) affine._m22 *= sy; break; } - m_dirty |= TxScale; + if (m_dirty < TxScale) + m_dirty = TxScale; return *this; } @@ -529,7 +531,8 @@ QTransform & QTransform::shear(qreal sh, qreal sv) break; } } - m_dirty |= TxShear; + if (m_dirty < TxShear) + m_dirty = TxShear; return *this; } @@ -605,7 +608,8 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis) break; } } - m_dirty |= TxRotate; + if (m_dirty < TxRotate) + m_dirty = TxRotate; } else { QTransform result; if (axis == Qt::YAxis) { @@ -677,7 +681,8 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis) break; } } - m_dirty |= TxRotate; + if (m_dirty < TxRotate) + m_dirty = TxRotate; } else { QTransform result; if (axis == Qt::YAxis) { diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp index 74c405e..3b13a41 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/qtransform/tst_qtransform.cpp @@ -603,6 +603,13 @@ void tst_QTransform::types() 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f); QCOMPARE(m3.type(), QTransform::TxProject); + + QTransform m4; + m4.scale(5, 5); + m4.translate(4, 2); + m4.rotate(45); + + QCOMPARE(m4.type(), QTransform::TxRotate); } -- cgit v0.12