summaryrefslogtreecommitdiffstats
path: root/src/gui/effects/qgraphicseffect.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-12-11 11:24:23 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-12-14 14:18:36 (GMT)
commit21c31b4a3ae972a4c2f03adebd43a2d6a27f8c93 (patch)
tree87a9f72381a6119f00fc7e6bbaf291195326c6ab /src/gui/effects/qgraphicseffect.cpp
parent8bbb0e70d189d7027494004a8dece8aeb4e37366 (diff)
downloadQt-21c31b4a3ae972a4c2f03adebd43a2d6a27f8c93.zip
Qt-21c31b4a3ae972a4c2f03adebd43a2d6a27f8c93.tar.gz
Qt-21c31b4a3ae972a4c2f03adebd43a2d6a27f8c93.tar.bz2
Added InvalidateReason to invalidateCache to optimize effects
This lets us ignore the invalidateCache call when the transform of a graphics item with an effect changes, and the cached system is LogicalCoordinates and cached mode is not PadToEffectiveBoundingRect. Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'src/gui/effects/qgraphicseffect.cpp')
-rw-r--r--src/gui/effects/qgraphicseffect.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 4f7ffc8..dafea52 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -374,10 +374,14 @@ QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate()
invalidateCache();
}
-void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const
+void QGraphicsEffectSourcePrivate::invalidateCache(InvalidateReason reason) const
{
- if (effectRectChanged && m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect)
+ if (m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect
+ && (reason == EffectRectChanged
+ || reason == TransformChanged
+ && m_cachedSystem == Qt::LogicalCoordinates))
return;
+
QPixmapCache::remove(m_cacheKey);
}
@@ -523,7 +527,7 @@ void QGraphicsEffect::updateBoundingRect()
Q_D(QGraphicsEffect);
if (d->source) {
d->source->d_func()->effectBoundingRectChanged();
- d->source->d_func()->invalidateCache(true);
+ d->source->d_func()->invalidateCache(QGraphicsEffectSourcePrivate::EffectRectChanged);
}
}