aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgadaptationlayer.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-08-13 10:17:53 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-08-23 10:55:35 +0200
commit441dca459286d5ab033be403f381c0914c6f74f9 (patch)
tree7e0d1fecb9df99208fab17b471b43a2e598c2c9f /src/quick/scenegraph/qsgadaptationlayer.cpp
parent8d0e307bc7f9f4458e6ea2d2fc0d6cd25be4fda9 (diff)
Improve the internal NodeVisitorEx API
Allow the implementation of visit to control whether the children should be processed afterwards or not. This is modelled after the JS AST visitor in Qml. Change-Id: I5b1adf5e1aefd8899bf444e993ddfbf2c5c125c9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgadaptationlayer.cpp')
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 68b1882c3f..1ed4122ce9 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -297,22 +297,22 @@ void QSGNodeVisitorEx::visitChildren(QSGNode *node)
switch (child->type()) {
case QSGNode::ClipNodeType: {
QSGClipNode *c = static_cast<QSGClipNode*>(child);
- visit(c);
- visitChildren(c);
+ if (visit(c))
+ visitChildren(c);
endVisit(c);
break;
}
case QSGNode::TransformNodeType: {
QSGTransformNode *c = static_cast<QSGTransformNode*>(child);
- visit(c);
- visitChildren(c);
+ if (visit(c))
+ visitChildren(c);
endVisit(c);
break;
}
case QSGNode::OpacityNodeType: {
QSGOpacityNode *c = static_cast<QSGOpacityNode*>(child);
- visit(c);
- visitChildren(c);
+ if (visit(c))
+ visitChildren(c);
endVisit(c);
break;
}
@@ -322,13 +322,19 @@ void QSGNodeVisitorEx::visitChildren(QSGNode *node)
v->accept(this);
} else {
QSGGeometryNode *c = static_cast<QSGGeometryNode*>(child);
- visit(c);
- visitChildren(c);
+ if (visit(c))
+ visitChildren(c);
endVisit(c);
}
break;
}
- case QSGNode::RootNodeType: // fall through
+ case QSGNode::RootNodeType: {
+ QSGRootNode *root = static_cast<QSGRootNode*>(child);
+ if (visit(root))
+ visitChildren(root);
+ endVisit(root);
+ break;
+ }
case QSGNode::BasicNodeType: {
visitChildren(child);
break;