diff options
author | Bjoern Erik Nilsen <bnilsen@trolltech.com> | 2009-02-25 11:18:28 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-15 10:14:07 (GMT) |
commit | c141a575930ae3eb7a98353838d9c7142dbe5b93 (patch) | |
tree | 05a91812407caf4cb7209d7d8a04f732b12ce06f /src | |
parent | 47bf9efe79f8f5750ab57945fe08a771f794c0a9 (diff) | |
download | Qt-c141a575930ae3eb7a98353838d9c7142dbe5b93.zip Qt-c141a575930ae3eb7a98353838d9c7142dbe5b93.tar.gz Qt-c141a575930ae3eb7a98353838d9c7142dbe5b93.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.
(cherry picked from commit e27743bdeda7aa3cb42f2d81a521121f8ee04eae)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 9e8a4f5..175e5a3 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; } |