diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-04 13:16:40 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-09 07:33:23 (GMT) |
commit | 5127105efd8f76721d7d9acf9681fd18e73760d8 (patch) | |
tree | 2c2c079f98b73d745c2ff84120fe174dd07b36a6 /src | |
parent | b6b0469e2d3aba2a163fab8c4b2fda4ab775b7f7 (diff) | |
download | Qt-5127105efd8f76721d7d9acf9681fd18e73760d8.zip Qt-5127105efd8f76721d7d9acf9681fd18e73760d8.tar.gz Qt-5127105efd8f76721d7d9acf9681fd18e73760d8.tar.bz2 |
Fix clipping bug, move code to avoid unintentional shadowing.
The children variable tested for clipping was the wrong variable. This
broke when the code was moved down as part of a previous cleanup change.
Reviewed-by: bnilsen
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7a6c21c..a137b06 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5152,20 +5152,6 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * } } - bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); - bool dontDrawItem = !item || viewBoundingRect.isEmpty(); - bool dontDrawChildren = item && dontDrawItem && childClip; - childClip &= !dontDrawChildren & !children.isEmpty(); - if (item && item->d_ptr->flags & QGraphicsItem::ItemHasNoContents) - dontDrawItem = true; - - // Clip children. - if (childClip) { - painter->save(); - painter->setWorldTransform(transformTmp); - painter->setClipPath(item->shape(), Qt::IntersectClip); - } - // Find and sort children. QList<QGraphicsItem *> tmp; QList<QGraphicsItem *> *children = 0; @@ -5192,6 +5178,20 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * tmp = tli; children = &tmp; } + + bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); + bool dontDrawItem = !item || viewBoundingRect.isEmpty(); + bool dontDrawChildren = item && dontDrawItem && childClip; + childClip &= !dontDrawChildren & !children->isEmpty(); + if (item && item->d_ptr->flags & QGraphicsItem::ItemHasNoContents) + dontDrawItem = true; + + // Clip children. + if (childClip) { + painter->save(); + painter->setWorldTransform(transformTmp); + painter->setClipPath(item->shape(), Qt::IntersectClip); + } if (!dontDrawChildren) { if (item && item->d_ptr->needSortChildren) { |