summaryrefslogtreecommitdiffstats
path: root/src/gui/effects/qgraphicseffect.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-10-30 12:37:05 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-11-02 11:57:54 (GMT)
commit85e41590732f15cec16909bf1121d944ae684373 (patch)
tree66d88bfcc51803f92749a8d5bcd0017857a7cbd5 /src/gui/effects/qgraphicseffect.cpp
parent17cda5c55273813cbedcced3a511f1c222978182 (diff)
downloadQt-85e41590732f15cec16909bf1121d944ae684373.zip
Qt-85e41590732f15cec16909bf1121d944ae684373.tar.gz
Qt-85e41590732f15cec16909bf1121d944ae684373.tar.bz2
Optimized graphics effects to not needlessly invalidate cache.
When the effect rect changes we only need to invalidate the cache if the mode is ExpandToEffectRectPadMode. Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src/gui/effects/qgraphicseffect.cpp')
-rw-r--r--src/gui/effects/qgraphicseffect.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 3a6bab5..c8e39da 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -279,6 +279,13 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse
return pm;
}
+void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const
+{
+ if (effectRectChanged && m_cachedMode != QGraphicsEffectSource::ExpandToEffectRectPadMode)
+ return;
+ QPixmapCache::remove(m_cacheKey);
+}
+
/*!
Constructs a new QGraphicsEffect instance having the
specified \a parent.
@@ -418,7 +425,7 @@ void QGraphicsEffect::updateBoundingRect()
Q_D(QGraphicsEffect);
if (d->source) {
d->source->d_func()->effectBoundingRectChanged();
- d->source->d_func()->invalidateCache();
+ d->source->d_func()->invalidateCache(true);
}
}