// QSGBasicGeometryNode
OwnsGeometry = 0x00010000,
OwnsMaterial = 0x00020000,
- OwnsOpaqueMaterial = 0x00040000
+ OwnsOpaqueMaterial = 0x00040000,
// Uppermost 8 bits are reserved for internal use.
+#ifndef qdoc
+ IsVisitableNode = 0x01000000
+#else
+ InternalReserved = 0x01000000
+#endif
};
Q_DECLARE_FLAGS(Flags, Flag)
}
}
+void QSGNodeVisitorEx::visitChildren(QSGNode *node)
+{
+ for (QSGNode *child = node->firstChild(); child; child = child->nextSibling()) {
+ switch (child->type()) {
+ case QSGNode::ClipNodeType: {
+ QSGClipNode *c = static_cast<QSGClipNode*>(child);
+ visit(c);
+ visitChildren(c);
+ endVisit(c);
+ break;
+ }
+ case QSGNode::TransformNodeType: {
+ QSGTransformNode *c = static_cast<QSGTransformNode*>(child);
+ visit(c);
+ visitChildren(c);
+ endVisit(c);
+ break;
+ }
+ case QSGNode::OpacityNodeType: {
+ QSGOpacityNode *c = static_cast<QSGOpacityNode*>(child);
+ visit(c);
+ visitChildren(c);
+ endVisit(c);
+ break;
+ }
+ case QSGNode::GeometryNodeType: {
+ if (child->flags() & QSGNode::IsVisitableNode) {
+ QSGVisitableNode *v = static_cast<QSGVisitableNode*>(child);
+ v->accept(this);
+ } else {
+ QSGGeometryNode *c = static_cast<QSGGeometryNode*>(child);
+ visit(c);
+ visitChildren(c);
+ endVisit(c);
+ }
+ break;
+ }
+ case QSGNode::BasicNodeType: {
+ visitChildren(child);
+ break;
+ }
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ }
+}
+
QT_END_NAMESPACE
class QSGDistanceFieldGlyphCacheManager;
class QSGDistanceFieldGlyphNode;
class QOpenGLContext;
+class QSGImageNode;
+class QSGRectangleNode;
+class QSGGlyphNode;
-class Q_QUICK_PRIVATE_EXPORT QSGRectangleNode : public QSGGeometryNode
+class Q_QUICK_PRIVATE_EXPORT QSGNodeVisitorEx
+{
+public:
+ virtual void visit(QSGTransformNode *) = 0;
+ virtual void endVisit(QSGTransformNode *) = 0;
+ virtual void visit(QSGClipNode *) = 0;
+ virtual void endVisit(QSGClipNode *) = 0;
+ virtual void visit(QSGGeometryNode *) = 0;
+ virtual void endVisit(QSGGeometryNode *) = 0;
+ virtual void visit(QSGOpacityNode *) = 0;
+ virtual void endVisit(QSGOpacityNode *) = 0;
+ virtual void visit(QSGImageNode *) = 0;
+ virtual void endVisit(QSGImageNode *) = 0;
+ virtual void visit(QSGRectangleNode *) = 0;
+ virtual void endVisit(QSGRectangleNode *) = 0;
+ virtual void visit(QSGGlyphNode *) = 0;
+ virtual void endVisit(QSGGlyphNode *) = 0;
+
+ void visitChildren(QSGNode *node);
+};
+
+
+class Q_QUICK_PRIVATE_EXPORT QSGVisitableNode : public QSGGeometryNode
+{
+public:
+ QSGVisitableNode() { setFlag(IsVisitableNode); }
+
+ virtual void accept(QSGNodeVisitorEx *) = 0;
+};
+
+class Q_QUICK_PRIVATE_EXPORT QSGRectangleNode : public QSGVisitableNode
{
public:
virtual void setRect(const QRectF &rect) = 0;
virtual void setAligned(bool aligned) = 0;
virtual void update() = 0;
+
+ virtual void accept(QSGNodeVisitorEx *visitor) { visitor->visit(this); visitor->visitChildren(this); visitor->endVisit(this); }
};
-class Q_QUICK_PRIVATE_EXPORT QSGImageNode : public QSGGeometryNode
+class Q_QUICK_PRIVATE_EXPORT QSGImageNode : public QSGVisitableNode
{
public:
virtual void setTargetRect(const QRectF &rect) = 0;
virtual void setVerticalWrapMode(QSGTexture::WrapMode wrapMode) = 0;
virtual void update() = 0;
+
+ virtual void accept(QSGNodeVisitorEx *visitor) { visitor->visit(this); visitor->visitChildren(this); visitor->endVisit(this); }
};
-class Q_QUICK_PRIVATE_EXPORT QSGGlyphNode : public QSGGeometryNode
+class Q_QUICK_PRIVATE_EXPORT QSGGlyphNode : public QSGVisitableNode
{
public:
enum AntialiasingMode
void setOwnerElement(QQuickItem *ownerElement) { m_ownerElement = ownerElement; }
QQuickItem *ownerElement() const { return m_ownerElement; }
+ virtual void accept(QSGNodeVisitorEx *visitor) { visitor->visit(this); visitor->visitChildren(this); visitor->endVisit(this); }
protected:
QRectF m_bounding_rect;
QQuickItem *m_ownerElement;