summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview/qgraphicsscene.cpp
diff options
context:
space:
mode:
authorDimitar Asenov <dimitar.asenov@gmail.com>2014-03-12 14:11:45 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-31 22:54:14 +0200
commit3270b4490bc420359483cb00ae48e91e261b30e8 (patch)
treed6e18a39fd0d21d36d10abe6edbfdb68084780ca /src/widgets/graphicsview/qgraphicsscene.cpp
parentd13d03f012b9c0516fa027f4e1ea18c12f1491ca (diff)
Add a new optimization flag to QGraphicsItem.
The new flag ItemContainsChildrenInShape is similar to the existing flag ItemClipsChildrenToShape. Setting the new flag makes QGraphicsScene assume that children are drawn within the shape of the current item but this is not enforced by clipping. When an application manually ensures this clipping boundary, setting the new flag removes the overhead of enforcing the clip with ItemClipsChildrenToShape, while still allowing other routines to behave more optimially by assuming children are within the shape of the current item. [ChangeLog][QtWidgets][QGraphicsItem] Added the ItemContainsChildrenInShape flag that enables using optimizations of ItemClipsChildrenToShape without the overhead of enforcing the clip. Change-Id: I5496fe1ca331b77fd51e0df8a3ace2b8e939eaf2 Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsscene.cpp')
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index a7584ef198..1cd162e6bb 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -4717,7 +4717,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
wasDirtyParentSceneTransform = true;
}
- const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape);
+ const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape
+ || item->d_ptr->flags & QGraphicsItem::ItemContainsChildrenInShape);
bool drawItem = itemHasContents && !itemIsFullyTransparent;
if (drawItem || minimumRenderSize > 0.0) {
const QRectF brect = adjustedItemEffectiveBoundingRect(item);
@@ -5221,7 +5222,8 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
// Process children.
if (itemHasChildren && item->d_ptr->dirtyChildren) {
- const bool itemClipsChildrenToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape;
+ const bool itemClipsChildrenToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape
+ || item->d_ptr->flags & QGraphicsItem::ItemContainsChildrenInShape;
// Items with no content are threated as 'dummy' items which means they are never drawn and
// 'processed', so the painted view bounding rect is never up-to-date. This means that whenever
// such an item changes geometry, its children have to take care of the update regardless