summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview/qgraphicsscene.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 5c6a8ae..cea723c 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4686,8 +4686,31 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (sourced->currentCachedSystem() != Qt::LogicalCoordinates
&& sourced->lastEffectTransform != painter->worldTransform())
{
+ bool unclipped = false;
+ if (sourced->lastEffectTransform.type() <= QTransform::TxTranslate
+ && painter->worldTransform().type() <= QTransform::TxTranslate)
+ {
+ QRectF itemRect = item->boundingRect();
+ if (!item->d_ptr->children.isEmpty())
+ itemRect |= item->childrenBoundingRect();
+
+ QRectF oldSourceRect = sourced->lastEffectTransform.mapRect(itemRect);
+ QRectF newSourceRect = painter->worldTransform().mapRect(itemRect);
+
+ QRect oldEffectRect = sourced->paddedEffectRect(sourced->currentCachedSystem(), sourced->currentCachedMode(), oldSourceRect);
+ QRect newEffectRect = sourced->paddedEffectRect(sourced->currentCachedSystem(), sourced->currentCachedMode(), newSourceRect);
+
+ QRect deviceRect(0, 0, painter->device()->width(), painter->device()->height());
+ if (deviceRect.contains(oldEffectRect) && deviceRect.contains(newEffectRect)) {
+ sourced->setCachedOffset(newEffectRect.topLeft());
+ unclipped = true;
+ }
+ }
+
sourced->lastEffectTransform = painter->worldTransform();
- sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged);
+
+ if (!unclipped)
+ sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged);
}
item->d_ptr->graphicsEffect->draw(painter);