summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2010-06-07 09:41:10 (GMT)
committerSamuli Piippo <samuli.piippo@digia.com>2011-06-09 10:06:10 (GMT)
commita8bdabd1c8538f43a17a64ccc93d3df604d18bae (patch)
treecf68ce58024998e1d192cbb69e778e92b6173326
parent74a67cfb47726008e9bb0acc34bb733132f4242f (diff)
downloadQt-a8bdabd1c8538f43a17a64ccc93d3df604d18bae.zip
Qt-a8bdabd1c8538f43a17a64ccc93d3df604d18bae.tar.gz
Qt-a8bdabd1c8538f43a17a64ccc93d3df604d18bae.tar.bz2
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: Samuel (cherry picked from commit 90e009e9e273a4fea5166007e4c2b0638c6588cd)
-rw-r--r--src/gui/painting/qtransform.cpp2
-rw-r--r--tests/auto/qtransform/tst_qtransform.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index ba21454..995bac8 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1565,7 +1565,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 346ec3f..14ec8a5 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)