summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-10 23:28:50 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-10 23:28:50 (GMT)
commitfd11ad94463300e16a8a085ae313816bab3049e7 (patch)
tree9062273fb921d5ce3d5f06a319d4297b93384dac /src/declarative
parent7b42a443384c884ce12a9499a95455a188dcb02d (diff)
downloadQt-fd11ad94463300e16a8a085ae313816bab3049e7.zip
Qt-fd11ad94463300e16a8a085ae313816bab3049e7.tar.gz
Qt-fd11ad94463300e16a8a085ae313816bab3049e7.tar.bz2
Revert 4bf7f90a27377f439e86d6175e5e3cdebd131be0 and implement differently.
Setting painter clip can reduce performance in some cases, so items must access system clip.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspainteditem.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp b/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp
index 2c849c8..b1b1210 100644
--- a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp
@@ -49,6 +49,7 @@
#include <QApplication>
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
+#include <QPaintEngine>
QT_BEGIN_NAMESPACE
@@ -209,9 +210,24 @@ void QmlGraphicsPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *
++inpaint;
- const QRect clip = p->clipRegion().boundingRect();
+ const QTransform &x = p->deviceTransform();
+ QTransform xinv = x.inverted();
+ QRegion effectiveClip;
+ QRegion sysClip = p->paintEngine()->systemClip();
+ if (xinv.type() <= QTransform::TxScale && sysClip.numRects() < 5) {
+ // simple transform, region gets no more complicated...
+ effectiveClip = xinv.map(sysClip);
+ } else {
+ // do not make complicated regions...
+ effectiveClip = xinv.mapRect(sysClip.boundingRect());
+ }
+
+ QRegion topaint = p->clipRegion();
+ if (topaint.isEmpty())
+ topaint = effectiveClip;
+ else
+ topaint &= effectiveClip;
- QRegion topaint(clip);
topaint &= content;
QRegion uncached(content);
p->setRenderHints(QPainter::SmoothPixmapTransform, d->smooth);