summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 9d7354a..b3e1701 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -5687,18 +5687,20 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect)
return;
}
- // Find pixmap in cache, then remove to avoid deep copy when modifying.s
+ // Find pixmap in cache.
QPixmap cachedPixmap;
if (!QPixmapCache::find(cache->key, &cachedPixmap)) {
update(rect);
return;
}
- QPixmapCache::remove(cache->key);
QRect scrollRect = (rect.isNull() ? boundingRect() : rect).toAlignedRect();
if (!scrollRect.intersects(cache->boundingRect))
return; // Nothing to scroll.
+ // Remove from cache to avoid deep copy when modifying.
+ QPixmapCache::remove(cache->key);
+
QRegion exposed;
cachedPixmap.scroll(dx, dy, scrollRect.translated(-cache->boundingRect.topLeft()), &exposed);