diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2014-10-15 14:13:53 +0200 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2014-10-29 22:25:48 +0100 |
commit | 4b73acd49cc4f08a5169efba8169f968094063e0 (patch) | |
tree | 38db09cd6bc7bc017d500c237e5d11ed7258bc00 /src/quick/items/qquickitem_p.h | |
parent | aed97ab52133a06f998bf481be2b0d08b2107185 (diff) |
Move from a count of cursors, to storing whether or not a subtree has a cursor.
Calculation of this is going to be slower (of course) as we have to recurse the
children, but this only happens when unsetting a cursor or removing a child item
from a tree that had a cursor.
On the other hand, wasting 4 bytes per ExtraData plus padding is quite a large
concern, and it was also forcing allocation of ExtraData for an entire tree that
had a cursor set.
This also reduces the size of ExtraData from 152 down to 144 bytes through
reordering of members on x86_64.
Change-Id: Iab14ee71c762285bf4448fc86399070263eb118d
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/items/qquickitem_p.h')
-rw-r--r-- | src/quick/items/qquickitem_p.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 2ae67c4c23..461b2f3485 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -342,7 +342,6 @@ public: mutable QQuickItemLayer *layer; #ifndef QT_NO_CURSOR QCursor cursor; - int numItemsWithCursor; #endif QPointF userTransformOriginPoint; @@ -353,6 +352,8 @@ public: QQuickDefaultClipNode *clipNode; QSGRootNode *rootNode; + QObjectList resourcesList; + // Although acceptedMouseButtons is inside ExtraData, we actually store // the LeftButton flag in the extra.flag() bit. This is because it is // extremely common to set acceptedMouseButtons to LeftButton, but very @@ -362,7 +363,7 @@ public: QQuickItem::TransformOrigin origin:5; uint transparentForPositioner : 1; - QObjectList resourcesList; + // 26 bits padding }; QLazilyAllocated<ExtraData> extra; @@ -414,6 +415,7 @@ public: bool culled:1; bool hasCursor:1; // Bit 32 + bool hasCursorInChild:1; bool activeFocusOnTab:1; bool implicitAntialiasing:1; bool antialiasingValid:1; @@ -576,7 +578,7 @@ public: virtual void mirrorChange() {} - void incrementCursorCount(int delta); + void setHasCursorInChild(bool hasCursor); // recursive helper to let a visual parent mark its visual children void markObjects(QV4::ExecutionEngine *e); |