From 37a0291f932b0af0f6844898ccbce52415f0f179 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 1 Jun 2010 14:01:10 +0200 Subject: Don't remove the pixmap from cache when not modifying it. Fixes one minor regression in the last commit to QGraphicsIten::scroll: if the expose region doesn't intersect with the cache pixmap, then there's no point in removing it. Reviewed-by: Alexis Menard --- src/gui/graphicsview/qgraphicsitem.cpp | 6 ++++-- 1 file 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); -- cgit v0.12