diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-02 01:29:10 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-02 01:29:10 (GMT) |
commit | 274f20b48c42b5ed1380e152fe414a2f98795acc (patch) | |
tree | e6a88d3d161b8e0d5e34af89dd28929794d36cee | |
parent | d106350fc8357efa1f400947f79e75625aec34da (diff) | |
download | Qt-274f20b48c42b5ed1380e152fe414a2f98795acc.zip Qt-274f20b48c42b5ed1380e152fe414a2f98795acc.tar.gz Qt-274f20b48c42b5ed1380e152fe414a2f98795acc.tar.bz2 |
Don't calculate map rect for items with no content
-rw-r--r-- | src/declarative/canvas/qsimplecanvas_opengl.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/declarative/canvas/qsimplecanvas_opengl.cpp b/src/declarative/canvas/qsimplecanvas_opengl.cpp index 72f8324..cbe069b 100644 --- a/src/declarative/canvas/qsimplecanvas_opengl.cpp +++ b/src/declarative/canvas/qsimplecanvas_opengl.cpp @@ -240,6 +240,7 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child) 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.) @@ -256,6 +257,7 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child) am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0); am.translate(-br.width() / 2., -br.height() / 2); } + child->d_func()->data()->transformValid = true; } } @@ -264,10 +266,18 @@ QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &boundin { Q_Q(QSimpleCanvasItem); - QRectF filteredBoundRect = q->boundingRect(); - if (filter) - filteredBoundRect = filter->itemBoundingRect(filteredBoundRect); - QRectF rv = data()->transformActive.mapRect(filteredBoundRect); + bool hasContents = options & QSimpleCanvasItem::HasContents; + + QRectF rv; + + if (hasContents) { + QRectF filteredBoundRect = q->boundingRect(); + if (filter) + filteredBoundRect = filter->itemBoundingRect(filteredBoundRect); + const QMatrix4x4 &active = data()->transformActive; + + rv = active.mapRect(filteredBoundRect); + } for (int ii = 0; ii < children.count(); ++ii) { QSimpleCanvasItem *child = children.at(ii); |