diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-06-01 17:40:53 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-06-01 17:40:53 (GMT) |
commit | 5c6e671c8cbab281af4685d3698790ab566ed2f2 (patch) | |
tree | 0f3e15d12cf984d8f49c7adfaf056063cc726803 /src/gui/graphicsview/qgraphicsitem.cpp | |
parent | 7165826d2e9ff77951a289c62746d6c87f725139 (diff) | |
parent | 0b034e816994f3c6ad5ba5e0e9f7c0c60ab9440d (diff) | |
download | Qt-5c6e671c8cbab281af4685d3698790ab566ed2f2.zip Qt-5c6e671c8cbab281af4685d3698790ab566ed2f2.tar.gz Qt-5c6e671c8cbab281af4685d3698790ab566ed2f2.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index c4ee99a..b867345 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1275,14 +1275,14 @@ void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rec QTransform matrix = childd->transformToParent(); if (x) matrix *= *x; - *rect |= matrix.mapRect(child->boundingRect()); + *rect |= matrix.mapRect(child->d_ptr->effectiveBoundingRect()); if (!childd->children.isEmpty()) childd->childrenBoundingRectHelper(&matrix, rect); } else { if (x) - *rect |= x->mapRect(child->boundingRect()); + *rect |= x->mapRect(child->d_ptr->effectiveBoundingRect()); else - *rect |= child->boundingRect(); + *rect |= child->d_ptr->effectiveBoundingRect(); if (!childd->children.isEmpty()) childd->childrenBoundingRectHelper(x, rect); } @@ -5687,32 +5687,28 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) return; } + // Find pixmap in cache, then remove to avoid deep copy when modifying.s 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. QRegion exposed; - const bool scrollEntirePixmap = rect.isNull(); - if (scrollEntirePixmap) { - // Scroll entire pixmap. - cachedPixmap.scroll(dx, dy, cachedPixmap.rect(), &exposed); - } else { - if (!rect.intersects(cache->boundingRect)) - return; // Nothing to scroll. - // Scroll sub-rect of pixmap. The rect is in item coordinates - // so we have to translate it to pixmap coordinates. - QRect scrollRect = rect.toAlignedRect(); - cachedPixmap.scroll(dx, dy, scrollRect.translated(-cache->boundingRect.topLeft()), &exposed); - } + cachedPixmap.scroll(dx, dy, scrollRect.translated(-cache->boundingRect.topLeft()), &exposed); - QPixmapCache::replace(cache->key, cachedPixmap); + // Reinsert into cache. + cache->key = QPixmapCache::insert(cachedPixmap); // Translate the existing expose. for (int i = 0; i < cache->exposed.size(); ++i) { QRectF &e = cache->exposed[i]; - if (!scrollEntirePixmap && !e.intersects(rect)) + if (!rect.isNull() && !e.intersects(rect)) continue; e.translate(dx, dy); } |