diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2011-04-26 14:00:35 +0200 |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2011-04-26 14:10:01 +0200 |
commit | 8daa62364d0330d35b8bbb4e9ad6800fe4e833c9 (patch) | |
tree | 28330edecb6c98f27da2f7730f6cb2dbaac547ab | |
parent | 436eccac21cb1b2c2c121911986c8a9d4a045cf3 (diff) |
Fixed item transforms in Scene Graph to match GraphicsView.
-rw-r--r-- | src/declarative/items/qsgcanvas.cpp | 10 | ||||
-rw-r--r-- | src/declarative/items/qsgitem.cpp | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 46d8675b7b..a325f0dac1 100644 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@ -1621,6 +1621,11 @@ void QSGCanvasPrivate::updateDirtyNode(QSGItem *item) if (itemPriv->x != 0. || itemPriv->y != 0.) matrix.translate(itemPriv->x, itemPriv->y); + if (dirty & QSGItemPrivate::ComplexTransformUpdateMask) { + for (int ii = itemPriv->transforms.count() - 1; ii >= 0; --ii) + itemPriv->transforms.at(ii)->applyTo(&matrix); + } + if (itemPriv->scale != 1. || itemPriv->rotation != 0.) { QPointF origin = itemPriv->computeTransformOrigin(); matrix.translate(origin.x(), origin.y()); @@ -1631,11 +1636,6 @@ void QSGCanvasPrivate::updateDirtyNode(QSGItem *item) matrix.translate(-origin.x(), -origin.y()); } - if (dirty & QSGItemPrivate::ComplexTransformUpdateMask) { - for (int ii = 0; ii < itemPriv->transforms.count(); ++ii) - itemPriv->transforms.at(ii)->applyTo(&matrix); - } - itemPriv->itemNode()->setMatrix(matrix); } diff --git a/src/declarative/items/qsgitem.cpp b/src/declarative/items/qsgitem.cpp index 4d3da127c1..b0df6b1a04 100644 --- a/src/declarative/items/qsgitem.cpp +++ b/src/declarative/items/qsgitem.cpp @@ -1238,6 +1238,13 @@ void QSGItemPrivate::itemToParentTransform(QTransform &t) const if (x || y) t.translate(x, y); + if (!transforms.isEmpty()) { + QMatrix4x4 m(t); + for (int ii = transforms.count() - 1; ii >= 0; --ii) + transforms.at(ii)->applyTo(&m); + t = m.toTransform(); + } + if (scale != 1. || rotation != 0.) { QPointF tp = computeTransformOrigin(); t.translate(tp.x(), tp.y()); @@ -1245,13 +1252,6 @@ void QSGItemPrivate::itemToParentTransform(QTransform &t) const t.rotate(rotation); t.translate(-tp.x(), -tp.y()); } - - if (!transforms.isEmpty()) { - QMatrix4x4 m(t); - for (int ii = 0; ii < transforms.count(); ++ii) - transforms.at(ii)->applyTo(&m); - t = m.toTransform(); - } } bool QSGItem::isComponentComplete() const |