summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorChristophe Oosterlynck <christophe.oosterlynck@dzine.be>2011-09-16 15:09:03 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-09-16 15:12:30 +0200
commit489661d3e69edf0c3011dcd5dd3ae800c9616617 (patch)
tree6e6286b8f5eccc8f515d47f96336ffe165744aa2 /src/gui/graphicsview
parent57240c1f931eb4c340de6e2bb17972235265f89c (diff)
Prevent unnecessary graphics item updates when graphics effect changes.
Don't invalidate a QGraphicsItem (neither its cache) when an update is triggered because of a QGraphicsEffect attached to it. Autotest for QGraphicsEffect extended with 2 cache invalidation tests Merge-request: 2681 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 0c218fc9f4..9092593918 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -5378,11 +5378,9 @@ void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively()
{
QGraphicsItemPrivate *itemPrivate = this;
do {
- if (itemPrivate->graphicsEffect) {
+ if (itemPrivate->graphicsEffect && !itemPrivate->updateDueToGraphicsEffect) {
itemPrivate->notifyInvalidated = 1;
-
- if (!itemPrivate->updateDueToGraphicsEffect)
- static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache();
+ static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache();
}
} while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
}
@@ -5690,21 +5688,27 @@ void QGraphicsItem::update(const QRectF &rect)
d_ptr->invalidateParentGraphicsEffectsRecursively();
#endif //QT_NO_GRAPHICSEFFECT
- if (CacheMode(d_ptr->cacheMode) != NoCache) {
- // Invalidate cache.
- QGraphicsItemCache *cache = d_ptr->extraItemCache();
- if (!cache->allExposed) {
- if (rect.isNull()) {
- cache->allExposed = true;
- cache->exposed.clear();
- } else {
- cache->exposed.append(rect);
+#ifndef QT_NO_GRAPHICSEFFECT
+ if (!d_ptr->updateDueToGraphicsEffect) {
+#endif
+ if (CacheMode(d_ptr->cacheMode) != NoCache) {
+ // Invalidate cache.
+ QGraphicsItemCache *cache = d_ptr->extraItemCache();
+ if (!cache->allExposed) {
+ if (rect.isNull()) {
+ cache->allExposed = true;
+ cache->exposed.clear();
+ } else {
+ cache->exposed.append(rect);
+ }
}
+ // Only invalidate cache; item is already dirty.
+ if (d_ptr->fullUpdatePending)
+ return;
}
- // Only invalidate cache; item is already dirty.
- if (d_ptr->fullUpdatePending)
- return;
+#ifndef QT_NO_GRAPHICSEFFECT
}
+#endif
if (d_ptr->scene)
d_ptr->scene->d_func()->markDirty(this, rect);