summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorBjoern Erik Nilsen <bnilsen@trolltech.com>2009-02-25 11:18:28 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-04-06 11:37:38 (GMT)
commite27743bdeda7aa3cb42f2d81a521121f8ee04eae (patch)
tree63555a31404df15fdbee4c62b37a087de46f3a5a /src/gui/graphicsview
parentcf65dea821a2ba796bb1f32c80de6b9db224dff5 (diff)
downloadQt-e27743bdeda7aa3cb42f2d81a521121f8ee04eae.zip
Qt-e27743bdeda7aa3cb42f2d81a521121f8ee04eae.tar.gz
Qt-e27743bdeda7aa3cb42f2d81a521121f8ee04eae.tar.bz2
Fixes: Optimize QGraphicsView::itemUpdated.
Task: - RevBy: Andreas AutoTest: - Details: Accumulate the parentToItem transform as we iterate instead of creating it from bottom-up each time.
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 2f7f57a..9b0e12d 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -804,10 +804,17 @@ void QGraphicsViewPrivate::itemUpdated(QGraphicsItem *item, const QRectF &rect)
if (item->isClipped()) {
// Minimize unnecessary redraw.
QGraphicsItem *p = item;
+ QTransform xform;
+ QGraphicsItem *lastTransformItem = 0;
while ((p = p->d_ptr->parent)) {
if (p->flags() & QGraphicsItem::ItemClipsChildrenToShape) {
- updateRect &= p->itemTransform(item).mapRect(p->boundingRect());
- if (updateRect.isNull())
+ if (!lastTransformItem)
+ xform = item->itemTransform(p);
+ else
+ xform *= lastTransformItem->itemTransform(p);
+ lastTransformItem = p;
+ updateRect &= xform.inverted().mapRect(p->boundingRect());
+ if (updateRect.isEmpty())
return;
}
@@ -815,7 +822,7 @@ void QGraphicsViewPrivate::itemUpdated(QGraphicsItem *item, const QRectF &rect)
break;
}
- if (updateRect.isNull())
+ if (updateRect.isEmpty())
return;
}