Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickshapes/qquickshapegenericrenderer_p.h |
Switch to Source code | Preprocessed file |
Line | Source | Count |
---|---|---|
1 | - | |
2 | - | |
3 | - | |
4 | class QQuickShapeGenericNode; | - |
5 | class QQuickShapeGenericStrokeFillNode; | - |
6 | class QQuickShapeFillRunnable; | - |
7 | class QQuickShapeStrokeRunnable; | - |
8 | - | |
9 | class QQuickShapeGenericRenderer : public QQuickAbstractPathRenderer | - |
10 | { | - |
11 | public: | - |
12 | enum Dirty { | - |
13 | DirtyFillGeom = 0x01, | - |
14 | DirtyStrokeGeom = 0x02, | - |
15 | DirtyColor = 0x04, | - |
16 | DirtyFillGradient = 0x08, | - |
17 | DirtyList = 0x10 | - |
18 | }; | - |
19 | - | |
20 | QQuickShapeGenericRenderer(QQuickItem *item) | - |
21 | : m_item(item), | - |
22 | m_api(QSGRendererInterface::Unknown), | - |
23 | m_rootNode(nullptr), | - |
24 | m_accDirty(0), | - |
25 | m_asyncCallback(nullptr), | - |
26 | m_asyncCallbackData(nullptr) | - |
27 | { } executed 83 times by 1 test: end of block Executed by:
| 83 |
28 | ~QQuickShapeGenericRenderer(); | - |
29 | - | |
30 | void beginSync(int totalCount) override; | - |
31 | void setPath(int index, const QQuickPath *path) override; | - |
32 | void setStrokeColor(int index, const QColor &color) override; | - |
33 | void setStrokeWidth(int index, qreal w) override; | - |
34 | void setFillColor(int index, const QColor &color) override; | - |
35 | void setFillRule(int index, QQuickShapePath::FillRule fillRule) override; | - |
36 | void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) override; | - |
37 | void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) override; | - |
38 | void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, | - |
39 | qreal dashOffset, const QVector<qreal> &dashPattern) override; | - |
40 | void setFillGradient(int index, QQuickShapeGradient *gradient) override; | - |
41 | void endSync(bool async) override; | - |
42 | void setAsyncCallback(void (*)(void *), void *) override; | - |
43 | Flags flags() const override { return executed 4 times by 1 test: SupportsAsync;return SupportsAsync; Executed by:
executed 4 times by 1 test: }return SupportsAsync; Executed by:
| 4 |
44 | - | |
45 | void updateNode() override; | - |
46 | - | |
47 | void setRootNode(QQuickShapeGenericNode *node); | - |
48 | - | |
49 | struct Color4ub { unsigned char r, g, b, a; }; | - |
50 | typedef QVector<QSGGeometry::ColoredPoint2D> VertexContainerType; | - |
51 | typedef QVector<quint32> IndexContainerType; | - |
52 | - | |
53 | static void triangulateFill(const QPainterPath &path, | - |
54 | const Color4ub &fillColor, | - |
55 | VertexContainerType *fillVertices, | - |
56 | IndexContainerType *fillIndices, | - |
57 | QSGGeometry::Type *indexType, | - |
58 | bool supportsElementIndexUint); | - |
59 | static void triangulateStroke(const QPainterPath &path, | - |
60 | const QPen &pen, | - |
61 | const Color4ub &strokeColor, | - |
62 | VertexContainerType *strokeVertices, | - |
63 | const QSize &clipSize); | - |
64 | - | |
65 | private: | - |
66 | void maybeUpdateAsyncItem(); | - |
67 | - | |
68 | struct ShapePathData { | - |
69 | float strokeWidth; | - |
70 | QPen pen; | - |
71 | Color4ub strokeColor; | - |
72 | Color4ub fillColor; | - |
73 | Qt::FillRule fillRule; | - |
74 | QPainterPath path; | - |
75 | FillGradientType fillGradientActive; | - |
76 | GradientDesc fillGradient; | - |
77 | VertexContainerType fillVertices; | - |
78 | IndexContainerType fillIndices; | - |
79 | QSGGeometry::Type indexType; | - |
80 | VertexContainerType strokeVertices; | - |
81 | int syncDirty; | - |
82 | int effectiveDirty = 0; | - |
83 | QQuickShapeFillRunnable *pendingFill = nullptr; | - |
84 | QQuickShapeStrokeRunnable *pendingStroke = nullptr; | - |
85 | }; | - |
86 | - | |
87 | void updateShadowDataInNode(ShapePathData *d, QQuickShapeGenericStrokeFillNode *n); | - |
88 | void updateFillNode(ShapePathData *d, QQuickShapeGenericNode *node); | - |
89 | void updateStrokeNode(ShapePathData *d, QQuickShapeGenericNode *node); | - |
90 | - | |
91 | QQuickItem *m_item; | - |
92 | QSGRendererInterface::GraphicsApi m_api; | - |
93 | QQuickShapeGenericNode *m_rootNode; | - |
94 | QVector<ShapePathData> m_sp; | - |
95 | int m_accDirty; | - |
96 | void (*m_asyncCallback)(void *); | - |
97 | void *m_asyncCallbackData; | - |
98 | }; | - |
99 | - | |
100 | class QQuickShapeFillRunnable : public QObject, public QRunnable | - |
101 | { | - |
102 | public: | - |
103 | #pragma GCC diagnostic push | - |
104 | - | |
105 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - |
106 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - |
107 | #pragma GCC diagnostic ignored "-Wattributes" | - |
108 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - |
109 | #pragma GCC diagnostic pop | - |
110 | struct QPrivateSignal {}; | - |
111 | - | |
112 | public: | - |
113 | void run() override; | - |
114 | - | |
115 | bool orphaned = false; | - |
116 | - | |
117 | - | |
118 | QPainterPath path; | - |
119 | QQuickShapeGenericRenderer::Color4ub fillColor; | - |
120 | bool supportsElementIndexUint; | - |
121 | - | |
122 | - | |
123 | QQuickShapeGenericRenderer::VertexContainerType fillVertices; | - |
124 | QQuickShapeGenericRenderer::IndexContainerType fillIndices; | - |
125 | QSGGeometry::Type indexType; | - |
126 | - | |
127 | public : | - |
128 | void done(QQuickShapeFillRunnable *self); | - |
129 | }; | - |
130 | - | |
131 | class QQuickShapeStrokeRunnable : public QObject, public QRunnable | - |
132 | { | - |
133 | public: | - |
134 | #pragma GCC diagnostic push | - |
135 | - | |
136 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - |
137 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - |
138 | #pragma GCC diagnostic ignored "-Wattributes" | - |
139 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - |
140 | #pragma GCC diagnostic pop | - |
141 | struct QPrivateSignal {}; | - |
142 | - | |
143 | public: | - |
144 | void run() override; | - |
145 | - | |
146 | bool orphaned = false; | - |
147 | - | |
148 | - | |
149 | QPainterPath path; | - |
150 | QPen pen; | - |
151 | QQuickShapeGenericRenderer::Color4ub strokeColor; | - |
152 | QSize clipSize; | - |
153 | - | |
154 | - | |
155 | QQuickShapeGenericRenderer::VertexContainerType strokeVertices; | - |
156 | - | |
157 | public : | - |
158 | void done(QQuickShapeStrokeRunnable *self); | - |
159 | }; | - |
160 | - | |
161 | class QQuickShapeGenericStrokeFillNode : public QSGGeometryNode | - |
162 | { | - |
163 | public: | - |
164 | QQuickShapeGenericStrokeFillNode(QQuickWindow *window); | - |
165 | - | |
166 | enum Material { | - |
167 | MatSolidColor, | - |
168 | MatLinearGradient, | - |
169 | MatRadialGradient, | - |
170 | MatConicalGradient | - |
171 | }; | - |
172 | - | |
173 | void activateMaterial(QQuickWindow *window, Material m); | - |
174 | - | |
175 | - | |
176 | QQuickAbstractPathRenderer::GradientDesc m_fillGradient; | - |
177 | - | |
178 | private: | - |
179 | QScopedPointer<QSGMaterial> m_material; | - |
180 | - | |
181 | friend class QQuickShapeGenericRenderer; | - |
182 | }; | - |
183 | - | |
184 | class QQuickShapeGenericNode : public QSGNode | - |
185 | { | - |
186 | public: | - |
187 | QQuickShapeGenericStrokeFillNode *m_fillNode = nullptr; | - |
188 | QQuickShapeGenericStrokeFillNode *m_strokeNode = nullptr; | - |
189 | QQuickShapeGenericNode *m_next = nullptr; | - |
190 | }; | - |
191 | - | |
192 | class QQuickShapeGenericMaterialFactory | - |
193 | { | - |
194 | public: | - |
195 | static QSGMaterial *createVertexColor(QQuickWindow *window); | - |
196 | static QSGMaterial *createLinearGradient(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node); | - |
197 | static QSGMaterial *createRadialGradient(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node); | - |
198 | static QSGMaterial *createConicalGradient(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node); | - |
199 | }; | - |
200 | - | |
201 | - | |
202 | - | |
203 | class QQuickShapeLinearGradientShader : public QSGMaterialShader | - |
204 | { | - |
205 | public: | - |
206 | QQuickShapeLinearGradientShader(); | - |
207 | - | |
208 | void initialize() override; | - |
209 | void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; | - |
210 | char const *const *attributeNames() const override; | - |
211 | - | |
212 | static QSGMaterialType type; | - |
213 | - | |
214 | private: | - |
215 | int m_opacityLoc = -1; | - |
216 | int m_matrixLoc = -1; | - |
217 | int m_gradStartLoc = -1; | - |
218 | int m_gradEndLoc = -1; | - |
219 | }; | - |
220 | - | |
221 | class QQuickShapeLinearGradientMaterial : public QSGMaterial | - |
222 | { | - |
223 | public: | - |
224 | QQuickShapeLinearGradientMaterial(QQuickShapeGenericStrokeFillNode *node) | - |
225 | : m_node(node) | - |
226 | { | - |
227 | - | |
228 | - | |
229 | - | |
230 | - | |
231 | - | |
232 | setFlag(Blending | RequiresFullMatrix); | - |
233 | } executed 12 times by 1 test: end of block Executed by:
| 12 |
234 | - | |
235 | QSGMaterialType *type() const override | - |
236 | { | - |
237 | return executed 14 times by 1 test: &QQuickShapeLinearGradientShader::type;return &QQuickShapeLinearGradientShader::type; Executed by:
executed 14 times by 1 test: return &QQuickShapeLinearGradientShader::type; Executed by:
| 14 |
238 | } | - |
239 | - | |
240 | int compare(const QSGMaterial *other) const override; | - |
241 | - | |
242 | QSGMaterialShader *createShader() const override | - |
243 | { | - |
244 | return executed 8 times by 1 test: new QQuickShapeLinearGradientShader;return new QQuickShapeLinearGradientShader; Executed by:
executed 8 times by 1 test: return new QQuickShapeLinearGradientShader; Executed by:
| 8 |
245 | } | - |
246 | - | |
247 | QQuickShapeGenericStrokeFillNode *node() const { return executed 8 times by 1 test: m_node;return m_node; Executed by:
executed 8 times by 1 test: }return m_node; Executed by:
| 8 |
248 | - | |
249 | private: | - |
250 | QQuickShapeGenericStrokeFillNode *m_node; | - |
251 | }; | - |
252 | - | |
253 | class QQuickShapeRadialGradientShader : public QSGMaterialShader | - |
254 | { | - |
255 | public: | - |
256 | QQuickShapeRadialGradientShader(); | - |
257 | - | |
258 | void initialize() override; | - |
259 | void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; | - |
260 | char const *const *attributeNames() const override; | - |
261 | - | |
262 | static QSGMaterialType type; | - |
263 | - | |
264 | private: | - |
265 | int m_opacityLoc = -1; | - |
266 | int m_matrixLoc = -1; | - |
267 | int m_translationPointLoc = -1; | - |
268 | int m_focalToCenterLoc = -1; | - |
269 | int m_centerRadiusLoc = -1; | - |
270 | int m_focalRadiusLoc = -1; | - |
271 | }; | - |
272 | - | |
273 | class QQuickShapeRadialGradientMaterial : public QSGMaterial | - |
274 | { | - |
275 | public: | - |
276 | QQuickShapeRadialGradientMaterial(QQuickShapeGenericStrokeFillNode *node) | - |
277 | : m_node(node) | - |
278 | { | - |
279 | setFlag(Blending | RequiresFullMatrix); | - |
280 | } executed 4 times by 1 test: end of block Executed by:
| 4 |
281 | - | |
282 | QSGMaterialType *type() const override | - |
283 | { | - |
284 | return executed 10 times by 1 test: &QQuickShapeRadialGradientShader::type;return &QQuickShapeRadialGradientShader::type; Executed by:
executed 10 times by 1 test: return &QQuickShapeRadialGradientShader::type; Executed by:
| 10 |
285 | } | - |
286 | - | |
287 | int compare(const QSGMaterial *other) const override; | - |
288 | - | |
289 | QSGMaterialShader *createShader() const override | - |
290 | { | - |
291 | return executed 4 times by 1 test: new QQuickShapeRadialGradientShader;return new QQuickShapeRadialGradientShader; Executed by:
executed 4 times by 1 test: return new QQuickShapeRadialGradientShader; Executed by:
| 4 |
292 | } | - |
293 | - | |
294 | QQuickShapeGenericStrokeFillNode *node() const { return executed 4 times by 1 test: m_node;return m_node; Executed by:
executed 4 times by 1 test: }return m_node; Executed by:
| 4 |
295 | - | |
296 | private: | - |
297 | QQuickShapeGenericStrokeFillNode *m_node; | - |
298 | }; | - |
299 | - | |
300 | class QQuickShapeConicalGradientShader : public QSGMaterialShader | - |
301 | { | - |
302 | public: | - |
303 | QQuickShapeConicalGradientShader(); | - |
304 | - | |
305 | void initialize() override; | - |
306 | void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; | - |
307 | char const *const *attributeNames() const override; | - |
308 | - | |
309 | static QSGMaterialType type; | - |
310 | - | |
311 | private: | - |
312 | int m_opacityLoc = -1; | - |
313 | int m_matrixLoc = -1; | - |
314 | int m_angleLoc = -1; | - |
315 | int m_translationPointLoc = -1; | - |
316 | }; | - |
317 | - | |
318 | class QQuickShapeConicalGradientMaterial : public QSGMaterial | - |
319 | { | - |
320 | public: | - |
321 | QQuickShapeConicalGradientMaterial(QQuickShapeGenericStrokeFillNode *node) | - |
322 | : m_node(node) | - |
323 | { | - |
324 | setFlag(Blending | RequiresFullMatrix); | - |
325 | } executed 3 times by 1 test: end of block Executed by:
| 3 |
326 | - | |
327 | QSGMaterialType *type() const override | - |
328 | { | - |
329 | return executed 9 times by 1 test: &QQuickShapeConicalGradientShader::type;return &QQuickShapeConicalGradientShader::type; Executed by:
executed 9 times by 1 test: return &QQuickShapeConicalGradientShader::type; Executed by:
| 9 |
330 | } | - |
331 | - | |
332 | int compare(const QSGMaterial *other) const override; | - |
333 | - | |
334 | QSGMaterialShader *createShader() const override | - |
335 | { | - |
336 | return executed 3 times by 1 test: new QQuickShapeConicalGradientShader;return new QQuickShapeConicalGradientShader; Executed by:
executed 3 times by 1 test: return new QQuickShapeConicalGradientShader; Executed by:
| 3 |
337 | } | - |
338 | - | |
339 | QQuickShapeGenericStrokeFillNode *node() const { return executed 3 times by 1 test: m_node;return m_node; Executed by:
executed 3 times by 1 test: }return m_node; Executed by:
| 3 |
340 | - | |
341 | private: | - |
342 | QQuickShapeGenericStrokeFillNode *m_node; | - |
343 | }; | - |
344 | - | |
345 | - | |
346 | - | |
347 | - | |
Switch to Source code | Preprocessed file |