summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem_p.h
diff options
context:
space:
mode:
authorBjoern Erik Nilsen <bjorn.nilsen@nokia.com>2009-05-08 14:00:57 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-05-15 15:55:44 (GMT)
commit59cc08796bfb88bc0010006f365f1361462761aa (patch)
tree44eebedc40e44546a5788cfb3ac497f1bab7e7d6 /src/gui/graphicsview/qgraphicsitem_p.h
parentb0095f7f8925cf571224d348124f08c56f7f46e9 (diff)
downloadQt-59cc08796bfb88bc0010006f365f1361462761aa.zip
Qt-59cc08796bfb88bc0010006f365f1361462761aa.tar.gz
Qt-59cc08796bfb88bc0010006f365f1361462761aa.tar.bz2
Graphics View Optimization: Use a simple style option by default.
QStyleOptionGraphicsItem extends QStyleOption with three values: 1) matrix, 2) levelOfDetail, 3) exposedRect, and they all involve expensive QTranform operations when calculated. We pass style option(s) to drawItems() and paint(), but the extended values are usually not in use. We can therefore gain quite some nice speedup by making them opt-in with the QGraphicsItem::ItemUsesExtendedStyleOption flag. Additionally, QStyleOptionGraphicsItem::levelOfDetail has been obsoleted, and a new function QStyleOptionGraphicsItem:: levelOfDetailFromTransform(const QTransform &) has been added. Me and Andreas don't consider this change to be too controversial even though it changes the behavior. Auto tests still pass. Reviewed-by: Andreas
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem_p.h')
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 2936cf1..82a48fb 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -132,7 +132,6 @@ public:
ancestorFlags(0),
cacheMode(0),
hasBoundingRegionGranularity(0),
- flags(0),
hasOpacity(0),
hasEffectiveOpacity(0),
isWidget(0),
@@ -142,6 +141,7 @@ public:
dirtyClipPath(1),
emptyClipPath(0),
inSetPosHelper(0),
+ flags(0),
allChildrenCombineOpacity(1),
globalStackingOrder(-1),
sceneTransformIndex(-1),
@@ -178,6 +178,8 @@ public:
void removeChild(QGraphicsItem *child);
void setParentItemHelper(QGraphicsItem *parent, bool deleting);
void childrenBoundingRectHelper(QTransform *x, QRectF *rect);
+ void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform,
+ const QRegion &exposedRegion, bool allItems = false) const;
virtual void resolveFont(uint inheritedMask)
{
@@ -297,7 +299,7 @@ public:
int index;
int depth;
- // Packed 32 bytes
+ // Packed 32 bits
quint32 acceptedMouseButtons : 5;
quint32 visible : 1;
quint32 explicitlyHidden : 1;
@@ -314,9 +316,6 @@ public:
quint32 ancestorFlags : 3;
quint32 cacheMode : 2;
quint32 hasBoundingRegionGranularity : 1;
- quint32 flags : 9;
-
- // New 32 bytes
quint32 hasOpacity : 1;
quint32 hasEffectiveOpacity : 1;
quint32 isWidget : 1;
@@ -326,7 +325,11 @@ public:
quint32 dirtyClipPath : 1;
quint32 emptyClipPath : 1;
quint32 inSetPosHelper : 1;
+
+ // New 32 bits
+ quint32 flags : 10;
quint32 allChildrenCombineOpacity : 1;
+ quint32 padding : 21; // feel free to use
// Optional stacking order
int globalStackingOrder;