summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-08 17:26:59 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-09 07:43:41 (GMT)
commite2e039954b2212a9cee0b7f72e383621f8bc6c8f (patch)
tree460ecc1c8c1085e57a84b23e1a60c198f1284eda /src
parente8be9f499547125490d61fb07b6aa023e38cd410 (diff)
downloadQt-e2e039954b2212a9cee0b7f72e383621f8bc6c8f.zip
Qt-e2e039954b2212a9cee0b7f72e383621f8bc6c8f.tar.gz
Qt-e2e039954b2212a9cee0b7f72e383621f8bc6c8f.tar.bz2
Revert 7aee2a7054d1ca280f6dfc9c46b3fe2ce403ccb3, fix render bugs.
This change introduced an unexpected interdependency for scenes with items that enable ItemStacksBehindParent, and that contain children that are transformed. There's a manual test for this, called clippingAndTransformations, which shows this problem. The bug has been fixed and this change also includes an autotest that covers exactly this problem.
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp15
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h1
2 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 7038c3d..7963ea1 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -5138,9 +5138,10 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
// Calculate the full transform for this item.
QRect viewBoundingRect;
bool wasDirtyParentSceneTransform = false;
+ QTransform transform;
if (item) {
if (item->d_ptr->itemIsUntransformable()) {
- transformTmp = item->deviceTransform(viewTransform);
+ transform = item->deviceTransform(viewTransform);
} else {
if (item->d_ptr->dirtySceneTransform) {
item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform
@@ -5149,14 +5150,14 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
item->d_ptr->dirtySceneTransform = 0;
wasDirtyParentSceneTransform = true;
}
- transformTmp = item->d_ptr->sceneTransform;
- transformTmp *= viewTransform;
+ transform = item->d_ptr->sceneTransform;
+ transform *= viewTransform;
}
QRectF brect = item->boundingRect();
// ### This does not take the clip into account.
_q_adjustRect(&brect);
- viewBoundingRect = transformTmp.mapRect(brect).toRect();
+ viewBoundingRect = transform.mapRect(brect).toRect();
item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect);
viewBoundingRect.adjust(-1, -1, 1, 1);
if (exposedRegion)
@@ -5200,7 +5201,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
// Clip children.
if (childClip) {
painter->save();
- painter->setWorldTransform(transformTmp);
+ painter->setWorldTransform(transform);
painter->setClipPath(item->shape(), Qt::IntersectClip);
}
@@ -5234,14 +5235,14 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
// Draw item
if (!dontDrawItem) {
- item->d_ptr->initStyleOption(&styleOptionTmp, transformTmp, exposedRegion ? *exposedRegion : QRegion(), exposedRegion == 0);
+ item->d_ptr->initStyleOption(&styleOptionTmp, transform, exposedRegion ? *exposedRegion : QRegion(), exposedRegion == 0);
bool clipsToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsToShape);
bool savePainter = clipsToShape || !(optimizationFlags & QGraphicsView::DontSavePainterState);
if (savePainter)
painter->save();
if (!childClip)
- painter->setWorldTransform(transformTmp);
+ painter->setWorldTransform(transform);
if (clipsToShape)
painter->setClipPath(item->shape(), Qt::IntersectClip);
painter->setOpacity(opacity);
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index fd7decf..000e2ba 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -290,7 +290,6 @@ public:
void updatePalette(const QPalette &palette);
QStyleOptionGraphicsItem styleOptionTmp;
- QTransform transformTmp;
};
QT_END_NAMESPACE