1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qsgsoftwarerenderlistbuilder_p.h"
5
6#include "qsgsoftwarerenderablenode_p.h"
7#include "qsgabstractsoftwarerenderer_p.h"
8#include "qsgsoftwareinternalimagenode_p.h"
9#include "qsgsoftwareinternalrectanglenode_p.h"
10#include "qsgsoftwareglyphnode_p.h"
11#include "qsgsoftwarepublicnodes_p.h"
12#include "qsgsoftwarepainternode_p.h"
13#include "qsgsoftwarepixmaptexture_p.h"
14
15#include <QtQuick/qsgsimplerectnode.h>
16#include <QtQuick/qsgsimpletexturenode.h>
17#include <QtQuick/qsgrendernode.h>
18
19QT_BEGIN_NAMESPACE
20
21QSGSoftwareRenderListBuilder::QSGSoftwareRenderListBuilder(QSGAbstractSoftwareRenderer *renderer)
22 : m_renderer(renderer)
23{
24
25}
26
27bool QSGSoftwareRenderListBuilder::visit(QSGTransformNode *)
28{
29 return true;
30}
31
32void QSGSoftwareRenderListBuilder::endVisit(QSGTransformNode *)
33{
34}
35
36bool QSGSoftwareRenderListBuilder::visit(QSGClipNode *)
37{
38 return true;
39}
40
41void QSGSoftwareRenderListBuilder::endVisit(QSGClipNode *)
42{
43}
44
45bool QSGSoftwareRenderListBuilder::visit(QSGGeometryNode *node)
46{
47 return addRenderableNode(node);
48}
49
50void QSGSoftwareRenderListBuilder::endVisit(QSGGeometryNode *)
51{
52}
53
54bool QSGSoftwareRenderListBuilder::visit(QSGOpacityNode *)
55{
56 return true;
57}
58
59void QSGSoftwareRenderListBuilder::endVisit(QSGOpacityNode *)
60{
61}
62
63bool QSGSoftwareRenderListBuilder::visit(QSGInternalImageNode *node)
64{
65 return addRenderableNode(node);
66}
67
68void QSGSoftwareRenderListBuilder::endVisit(QSGInternalImageNode *)
69{
70}
71
72bool QSGSoftwareRenderListBuilder::visit(QSGPainterNode *node)
73{
74 return addRenderableNode(node);
75}
76
77void QSGSoftwareRenderListBuilder::endVisit(QSGPainterNode *)
78{
79}
80
81bool QSGSoftwareRenderListBuilder::visit(QSGInternalRectangleNode *node)
82{
83 return addRenderableNode(node);
84}
85
86void QSGSoftwareRenderListBuilder::endVisit(QSGInternalRectangleNode *)
87{
88}
89
90bool QSGSoftwareRenderListBuilder::visit(QSGGlyphNode *node)
91{
92 return addRenderableNode(node);
93}
94
95void QSGSoftwareRenderListBuilder::endVisit(QSGGlyphNode *)
96{
97}
98
99bool QSGSoftwareRenderListBuilder::visit(QSGRootNode *)
100{
101 return true;
102}
103
104void QSGSoftwareRenderListBuilder::endVisit(QSGRootNode *)
105{
106}
107
108#if QT_CONFIG(quick_sprite)
109bool QSGSoftwareRenderListBuilder::visit(QSGSpriteNode *node)
110{
111 return addRenderableNode(node);
112}
113
114void QSGSoftwareRenderListBuilder::endVisit(QSGSpriteNode *)
115{
116
117}
118#endif
119
120bool QSGSoftwareRenderListBuilder::visit(QSGRenderNode *node)
121{
122 return addRenderableNode(node);
123}
124
125void QSGSoftwareRenderListBuilder::endVisit(QSGRenderNode *)
126{
127}
128
129bool QSGSoftwareRenderListBuilder::addRenderableNode(QSGNode *node)
130{
131 auto renderableNode = m_renderer->renderableNode(node);
132 if (renderableNode == nullptr) {
133 // Not a node we can render
134 return false;
135 }
136 m_renderer->appendRenderableNode(node: renderableNode);
137 return true;
138}
139
140QT_END_NAMESPACE
141

source code of qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder.cpp