diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2010-06-01 12:01:10 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2010-06-01 12:26:13 (GMT) |
commit | 37a0291f932b0af0f6844898ccbce52415f0f179 (patch) | |
tree | 3e6c43b73402e96cb0bb1f39d88b275ac48fddfd | |
parent | 08952f6c261d6bac27810b3f11420f0f2c513f22 (diff) | |
download | Qt-37a0291f932b0af0f6844898ccbce52415f0f179.zip Qt-37a0291f932b0af0f6844898ccbce52415f0f179.tar.gz Qt-37a0291f932b0af0f6844898ccbce52415f0f179.tar.bz2 |
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 <alexis.menard@nokia.com>
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 6 |
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); |