summaryrefslogtreecommitdiffstats
path: root/src/gui/effects/qgraphicseffect.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-10-30 18:28:43 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-11-02 11:57:55 (GMT)
commitcb357aad0f26c36eb1f942ae37647f9de071c948 (patch)
tree37727bff7fbcf57013b5418b952a49c8359e5cba /src/gui/effects/qgraphicseffect.cpp
parent64fbefa605d976ab752149bb39880893c82ad8c0 (diff)
downloadQt-cb357aad0f26c36eb1f942ae37647f9de071c948.zip
Qt-cb357aad0f26c36eb1f942ae37647f9de071c948.tar.gz
Qt-cb357aad0f26c36eb1f942ae37647f9de071c948.tar.bz2
Made QGraphicsEffectSource::draw() use cached pixmap if possible.
Small optimization for the case where the source pixmap is cached. Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src/gui/effects/qgraphicseffect.cpp')
-rw-r--r--src/gui/effects/qgraphicseffect.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index e181b18..78a18d3 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -210,7 +210,23 @@ const QStyleOption *QGraphicsEffectSource::styleOption() const
*/
void QGraphicsEffectSource::draw(QPainter *painter)
{
- d_func()->draw(painter);
+ Q_D(const QGraphicsEffectSource);
+
+ QPixmap pm;
+ if (QPixmapCache::find(d->m_cacheKey, &pm)) {
+ QTransform restoreTransform;
+ if (d->m_cachedSystem == Qt::DeviceCoordinates) {
+ restoreTransform = painter->worldTransform();
+ painter->setWorldTransform(QTransform());
+ }
+
+ painter->drawPixmap(d->m_cachedOffset, pm);
+
+ if (d->m_cachedSystem == Qt::DeviceCoordinates)
+ painter->setWorldTransform(restoreTransform);
+ } else {
+ d_func()->draw(painter);
+ }
}
/*!