From 8ea9fa4287fc09069297417f479209d7e0910ea2 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 7 Jun 2010 11:41:10 +0200 Subject: [PATCH] Fix QTransform::map(const QPainterPath &) not working with paths that have only one element Replaced the isEmpty() check for the shortcut in map() with elementCount() == 0 Task-number: QTBUG-11264 Reviewed-by: Pending --- src/gui/painting/qtransform.cpp | 2 +- tests/auto/qtransform/tst_qtransform.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 423cce9..47b7758 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1626,7 +1626,7 @@ static QPainterPath mapProjective(const QTransform &transform, const QPainterPat QPainterPath QTransform::map(const QPainterPath &path) const { TransformationType t = inline_type(); - if (t == TxNone || path.isEmpty()) + if (t == TxNone || path.elementCount() == 0) return path; if (t >= TxProject) diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp index a3ded8e..c784b3a 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/qtransform/tst_qtransform.cpp @@ -85,6 +85,7 @@ private slots: void inverted(); void projectivePathMapping(); void mapInt(); + void mapPathWithPoint(); private: void mapping_data(); @@ -793,6 +794,13 @@ void tst_QTransform::mapInt() QCOMPARE(y, 10); } +void tst_QTransform::mapPathWithPoint() +{ + QPainterPath p(QPointF(10, 10)); + p = QTransform::fromTranslate(10, 10).map(p); + QCOMPARE(p.currentPosition(), QPointF(20, 20)); +} + QTEST_APPLESS_MAIN(tst_QTransform) -- 1.7.1.11.g3bf78