OpenCoverage

qquickshapegenericrenderer_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickshapes/qquickshapegenericrenderer_p.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4class QQuickShapeGenericNode;-
5class QQuickShapeGenericStrokeFillNode;-
6class QQuickShapeFillRunnable;-
7class QQuickShapeStrokeRunnable;-
8-
9class QQuickShapeGenericRenderer : public QQuickAbstractPathRenderer-
10{-
11public:-
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:
  • tst_examples
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: return SupportsAsync;
Executed by:
  • tst_examples
SupportsAsync;
executed 4 times by 1 test: return SupportsAsync;
Executed by:
  • tst_examples
}
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-
65private:-
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-
100class 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-
112public:-
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-
127public :-
128 void done(QQuickShapeFillRunnable *self);-
129};-
130-
131class 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-
143public:-
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-
157public :-
158 void done(QQuickShapeStrokeRunnable *self);-
159};-
160-
161class QQuickShapeGenericStrokeFillNode : public QSGGeometryNode-
162{-
163public:-
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-
178private:-
179 QScopedPointer<QSGMaterial> m_material;-
180-
181 friend class QQuickShapeGenericRenderer;-
182};-
183-
184class QQuickShapeGenericNode : public QSGNode-
185{-
186public:-
187 QQuickShapeGenericStrokeFillNode *m_fillNode = nullptr;-
188 QQuickShapeGenericStrokeFillNode *m_strokeNode = nullptr;-
189 QQuickShapeGenericNode *m_next = nullptr;-
190};-
191-
192class QQuickShapeGenericMaterialFactory-
193{-
194public:-
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-
203class QQuickShapeLinearGradientShader : public QSGMaterialShader-
204{-
205public:-
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-
214private:-
215 int m_opacityLoc = -1;-
216 int m_matrixLoc = -1;-
217 int m_gradStartLoc = -1;-
218 int m_gradEndLoc = -1;-
219};-
220-
221class QQuickShapeLinearGradientMaterial : public QSGMaterial-
222{-
223public:-
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:
  • tst_examples
12
234-
235 QSGMaterialType *type() const override-
236 {-
237 return
executed 14 times by 1 test: return &QQuickShapeLinearGradientShader::type;
Executed by:
  • tst_examples
&QQuickShapeLinearGradientShader::type;
executed 14 times by 1 test: return &QQuickShapeLinearGradientShader::type;
Executed by:
  • tst_examples
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: return new QQuickShapeLinearGradientShader;
Executed by:
  • tst_examples
new QQuickShapeLinearGradientShader;
executed 8 times by 1 test: return new QQuickShapeLinearGradientShader;
Executed by:
  • tst_examples
8
245 }-
246-
247 QQuickShapeGenericStrokeFillNode *node() const { return
executed 8 times by 1 test: return m_node;
Executed by:
  • tst_examples
m_node;
executed 8 times by 1 test: return m_node;
Executed by:
  • tst_examples
}
8
248-
249private:-
250 QQuickShapeGenericStrokeFillNode *m_node;-
251};-
252-
253class QQuickShapeRadialGradientShader : public QSGMaterialShader-
254{-
255public:-
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-
264private:-
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-
273class QQuickShapeRadialGradientMaterial : public QSGMaterial-
274{-
275public:-
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:
  • tst_examples
4
281-
282 QSGMaterialType *type() const override-
283 {-
284 return
executed 10 times by 1 test: return &QQuickShapeRadialGradientShader::type;
Executed by:
  • tst_examples
&QQuickShapeRadialGradientShader::type;
executed 10 times by 1 test: return &QQuickShapeRadialGradientShader::type;
Executed by:
  • tst_examples
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: return new QQuickShapeRadialGradientShader;
Executed by:
  • tst_examples
new QQuickShapeRadialGradientShader;
executed 4 times by 1 test: return new QQuickShapeRadialGradientShader;
Executed by:
  • tst_examples
4
292 }-
293-
294 QQuickShapeGenericStrokeFillNode *node() const { return
executed 4 times by 1 test: return m_node;
Executed by:
  • tst_examples
m_node;
executed 4 times by 1 test: return m_node;
Executed by:
  • tst_examples
}
4
295-
296private:-
297 QQuickShapeGenericStrokeFillNode *m_node;-
298};-
299-
300class QQuickShapeConicalGradientShader : public QSGMaterialShader-
301{-
302public:-
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-
311private:-
312 int m_opacityLoc = -1;-
313 int m_matrixLoc = -1;-
314 int m_angleLoc = -1;-
315 int m_translationPointLoc = -1;-
316};-
317-
318class QQuickShapeConicalGradientMaterial : public QSGMaterial-
319{-
320public:-
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:
  • tst_examples
3
326-
327 QSGMaterialType *type() const override-
328 {-
329 return
executed 9 times by 1 test: return &QQuickShapeConicalGradientShader::type;
Executed by:
  • tst_examples
&QQuickShapeConicalGradientShader::type;
executed 9 times by 1 test: return &QQuickShapeConicalGradientShader::type;
Executed by:
  • tst_examples
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: return new QQuickShapeConicalGradientShader;
Executed by:
  • tst_examples
new QQuickShapeConicalGradientShader;
executed 3 times by 1 test: return new QQuickShapeConicalGradientShader;
Executed by:
  • tst_examples
3
337 }-
338-
339 QQuickShapeGenericStrokeFillNode *node() const { return
executed 3 times by 1 test: return m_node;
Executed by:
  • tst_examples
m_node;
executed 3 times by 1 test: return m_node;
Executed by:
  • tst_examples
}
3
340-
341private:-
342 QQuickShapeGenericStrokeFillNode *m_node;-
343};-
344-
345-
346-
347-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0