summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-18 00:47:46 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-18 00:47:46 (GMT)
commit919f0ca4bf848974b55d0af833d80b3c3d4ce6b1 (patch)
treeae352f4d0dde13d0ba3fa430c423a9368e8a6858 /src
parent6566578d6301523e1e17d0aa5af2663822ffb567 (diff)
parentd15888540f3b99c6add70106dda1dc1e262b8b00 (diff)
downloadQt-919f0ca4bf848974b55d0af833d80b3c3d4ce6b1.zip
Qt-919f0ca4bf848974b55d0af833d80b3c3d4ce6b1.tar.gz
Qt-919f0ca4bf848974b55d0af833d80b3c3d4ce6b1.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r--src/declarative/canvas/qsimplecanvas_software.cpp106
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.cpp2
-rw-r--r--src/declarative/canvas/qsimplecanvasitem_p.h2
3 files changed, 60 insertions, 50 deletions
diff --git a/src/declarative/canvas/qsimplecanvas_software.cpp b/src/declarative/canvas/qsimplecanvas_software.cpp
index 194024d..f822677 100644
--- a/src/declarative/canvas/qsimplecanvas_software.cpp
+++ b/src/declarative/canvas/qsimplecanvas_software.cpp
@@ -51,52 +51,56 @@ QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding
QRectF boundingRectActive = q->boundingRect();
QRect rv =
data()->transformActive.mapRect(boundingRectActive).toAlignedRect() & bounding;
+ data()->doNotPaint = rv.isEmpty();
+ data()->doNotPaintChildren = data()->doNotPaint && q->clip();
QRect myBounding = bounding;
if (q->clip())
myBounding &= rv;
- for (int ii = 0; ii < children.count(); ++ii) {
- QSimpleCanvasItem *child = children.at(ii);
-
- qreal visible = child->visible();
- child->d_func()->data()->activeOpacity = data()->activeOpacity;
- if (visible != 1)
- child->d_func()->data()->activeOpacity *= visible;
-
- if (child->d_func()->data()->activeOpacity != 0) {
- // Calculate child's transform
- qreal x = child->x();
- qreal y = child->y();
- qreal scale = child->scale();
- QSimpleCanvasItem::Flip flip = child->flip();
-
- QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive;
- am = data()->transformActive;
- if (x != 0 || y != 0)
- am.translate(x, y);
- if (scale != 1) {
- QPointF to = child->d_func()->transformOrigin();
- if (to.x() != 0. || to.y() != 0.)
- am.translate(to.x(), to.y());
- am.scale(scale, scale);
- if (to.x() != 0. || to.y() != 0.)
- am.translate(-to.x(), -to.y());
- }
-
- if (child->d_func()->data()->transformUser)
- am = *child->d_func()->data()->transformUser * am;
-
- if (flip) {
- QRectF br = child->boundingRect();
- am.translate(br.width() / 2., br.height() / 2);
- am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1,
- (flip & QSimpleCanvasItem::VerticalFlip)?-1:1);
- am.translate(-br.width() / 2., -br.height() / 2);
- }
- child->d_func()->data()->transformValid = true;
- rv |= child->d_func()->setupPainting(version, myBounding);
- }
- }
+ if (!data()->doNotPaintChildren) {
+ for (int ii = 0; ii < children.count(); ++ii) {
+ QSimpleCanvasItem *child = children.at(ii);
+
+ qreal visible = child->visible();
+ child->d_func()->data()->activeOpacity = data()->activeOpacity;
+ if (visible != 1)
+ child->d_func()->data()->activeOpacity *= visible;
+
+ if (child->d_func()->data()->activeOpacity != 0) {
+ // Calculate child's transform
+ qreal x = child->x();
+ qreal y = child->y();
+ qreal scale = child->scale();
+ QSimpleCanvasItem::Flip flip = child->flip();
+
+ QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive;
+ am = data()->transformActive;
+ if (x != 0 || y != 0)
+ am.translate(x, y);
+ if (scale != 1) {
+ QPointF to = child->d_func()->transformOrigin();
+ if (to.x() != 0. || to.y() != 0.)
+ am.translate(to.x(), to.y());
+ am.scale(scale, scale);
+ if (to.x() != 0. || to.y() != 0.)
+ am.translate(-to.x(), -to.y());
+ }
+
+ if (child->d_func()->data()->transformUser)
+ am = *child->d_func()->data()->transformUser * am;
+
+ if (flip) {
+ QRectF br = child->boundingRect();
+ am.translate(br.width() / 2., br.height() / 2);
+ am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1,
+ (flip & QSimpleCanvasItem::VerticalFlip)?-1:1);
+ am.translate(-br.width() / 2., -br.height() / 2);
+ }
+ child->d_func()->data()->transformValid = true;
+ rv |= child->d_func()->setupPainting(version, myBounding);
+ }
+ }
+ }
data()->lastPaintRect = rv;
return rv;
@@ -162,13 +166,17 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
}
}
- p.setWorldTransform(data()->transformActive);
- q->paintContents(p);
-
- for (; upto < children.count(); ++upto) {
- QSimpleCanvasItem *c = children.at(upto);
- paintChild(p, c);
- }
+ if (!data()->doNotPaint) {
+ p.setWorldTransform(data()->transformActive);
+ q->paintContents(p);
+ }
+
+ if (!data()->doNotPaintChildren) {
+ for (; upto < children.count(); ++upto) {
+ QSimpleCanvasItem *c = children.at(upto);
+ paintChild(p, c);
+ }
+ }
if (clip)
p.restore();
diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp
index 12c725c..9c110d7 100644
--- a/src/declarative/canvas/qsimplecanvasitem.cpp
+++ b/src/declarative/canvas/qsimplecanvasitem.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
QSimpleCanvasItemData::QSimpleCanvasItemData()
: buttons(Qt::NoButton), flip(QSimpleCanvasItem::NoFlip),
- dirty(false), transformValid(true), x(0), y(0), z(0), visible(1),
+ dirty(false), transformValid(true), doNotPaint(false), doNotPaintChildren(false), x(0), y(0), z(0), visible(1),
transformUser(0), activeOpacity(1)
{
}
diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h
index cfe0bba..a20b8f4 100644
--- a/src/declarative/canvas/qsimplecanvasitem_p.h
+++ b/src/declarative/canvas/qsimplecanvasitem_p.h
@@ -92,6 +92,8 @@ public:
QSimpleCanvasItem::Flip flip:2;
bool dirty:1;
bool transformValid:1;
+ bool doNotPaint:1;
+ bool doNotPaintChildren:1;
qreal x;
qreal y;