From 4fc638c0b4562f4b1e9c9a367535e4b570602942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 11 Mar 2010 15:21:43 +0100 Subject: Fixed bug in QTransform::type() after using operator/ or operator*. The m_dirty variable is not a bit flag any more. This caused the switch in QTransform::type() to not match any of the transformation types, and m_type was left at TxNone. Task-number: QTBUG-8557 Reviewed-by: Gunnar Sletta --- src/gui/painting/qtransform.h | 7 ++++--- tests/auto/qtransform/tst_qtransform.cpp | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 9909643..212a582 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -293,7 +293,8 @@ inline QTransform &QTransform::operator*=(qreal num) affine._dx *= num; affine._dy *= num; m_33 *= num; - m_dirty |= TxScale; + if (m_dirty < TxScale) + m_dirty = TxScale; return *this; } inline QTransform &QTransform::operator/=(qreal div) @@ -316,7 +317,7 @@ inline QTransform &QTransform::operator+=(qreal num) affine._dx += num; affine._dy += num; m_33 += num; - m_dirty |= TxProject; + m_dirty = TxProject; return *this; } inline QTransform &QTransform::operator-=(qreal num) @@ -332,7 +333,7 @@ inline QTransform &QTransform::operator-=(qreal num) affine._dx -= num; affine._dy -= num; m_33 -= num; - m_dirty |= TxProject; + m_dirty = TxProject; return *this; } diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp index 827a486..a3ded8e 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/qtransform/tst_qtransform.cpp @@ -610,6 +610,11 @@ void tst_QTransform::types() m4.rotate(45); QCOMPARE(m4.type(), QTransform::TxRotate); + + QTransform m5; + m5.scale(5, 5); + m5 = m5.adjoint() / m5.determinant(); + QCOMPARE(m5.type(), QTransform::TxScale); } -- cgit v0.12