Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickshapes/qquickshapegenericrenderer.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | static const qreal TRI_SCALE = 1; | - | ||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | struct ColoredVertex | - | ||||||||||||||||||||||||
10 | { | - | ||||||||||||||||||||||||
11 | float x, y; | - | ||||||||||||||||||||||||
12 | QQuickShapeGenericRenderer::Color4ub color; | - | ||||||||||||||||||||||||
13 | void set(float nx, float ny, QQuickShapeGenericRenderer::Color4ub ncolor) | - | ||||||||||||||||||||||||
14 | { | - | ||||||||||||||||||||||||
15 | x = nx; y = ny; color = ncolor; | - | ||||||||||||||||||||||||
16 | } executed 85750 times by 1 test: end of block Executed by:
| 85750 | ||||||||||||||||||||||||
17 | }; | - | ||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||
19 | static inline QQuickShapeGenericRenderer::Color4ub colorToColor4ub(const QColor &c) | - | ||||||||||||||||||||||||
20 | { | - | ||||||||||||||||||||||||
21 | QQuickShapeGenericRenderer::Color4ub color = { | - | ||||||||||||||||||||||||
22 | uchar(qRound(c.redF() * c.alphaF() * 255)), | - | ||||||||||||||||||||||||
23 | uchar(qRound(c.greenF() * c.alphaF() * 255)), | - | ||||||||||||||||||||||||
24 | uchar(qRound(c.blueF() * c.alphaF() * 255)), | - | ||||||||||||||||||||||||
25 | uchar(qRound(c.alphaF() * 255)) | - | ||||||||||||||||||||||||
26 | }; | - | ||||||||||||||||||||||||
27 | return executed 2078 times by 1 test: color;return color; Executed by:
executed 2078 times by 1 test: return color; Executed by:
| 2078 | ||||||||||||||||||||||||
28 | } | - | ||||||||||||||||||||||||
29 | - | |||||||||||||||||||||||||
30 | QQuickShapeGenericStrokeFillNode::QQuickShapeGenericStrokeFillNode(QQuickWindow *window) | - | ||||||||||||||||||||||||
31 | : m_material(nullptr) | - | ||||||||||||||||||||||||
32 | { | - | ||||||||||||||||||||||||
33 | setFlag(QSGNode::OwnsGeometry, true); | - | ||||||||||||||||||||||||
34 | setGeometry(new QSGGeometry(QSGGeometry::defaultAttributes_ColoredPoint2D(), 0, 0)); | - | ||||||||||||||||||||||||
35 | activateMaterial(window, MatSolidColor); | - | ||||||||||||||||||||||||
36 | - | |||||||||||||||||||||||||
37 | qsgnode_set_description(this, QLatin1String("stroke-fill")); | - | ||||||||||||||||||||||||
38 | - | |||||||||||||||||||||||||
39 | } executed 1327 times by 1 test: end of block Executed by:
| 1327 | ||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | void QQuickShapeGenericStrokeFillNode::activateMaterial(QQuickWindow *window, Material m) | - | ||||||||||||||||||||||||
42 | { | - | ||||||||||||||||||||||||
43 | switch (m) { | - | ||||||||||||||||||||||||
44 | case executed 1341 times by 1 test: MatSolidColor:case MatSolidColor: Executed by:
executed 1341 times by 1 test: case MatSolidColor: Executed by:
| 1341 | ||||||||||||||||||||||||
45 | - | |||||||||||||||||||||||||
46 | - | |||||||||||||||||||||||||
47 | m_material.reset(QQuickShapeGenericMaterialFactory::createVertexColor(window)); | - | ||||||||||||||||||||||||
48 | break; executed 1341 times by 1 test: break; Executed by:
| 1341 | ||||||||||||||||||||||||
49 | case executed 12 times by 1 test: MatLinearGradient:case MatLinearGradient: Executed by:
executed 12 times by 1 test: case MatLinearGradient: Executed by:
| 12 | ||||||||||||||||||||||||
50 | m_material.reset(QQuickShapeGenericMaterialFactory::createLinearGradient(window, this)); | - | ||||||||||||||||||||||||
51 | break; executed 12 times by 1 test: break; Executed by:
| 12 | ||||||||||||||||||||||||
52 | case executed 4 times by 1 test: MatRadialGradient:case MatRadialGradient: Executed by:
executed 4 times by 1 test: case MatRadialGradient: Executed by:
| 4 | ||||||||||||||||||||||||
53 | m_material.reset(QQuickShapeGenericMaterialFactory::createRadialGradient(window, this)); | - | ||||||||||||||||||||||||
54 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||
55 | case executed 3 times by 1 test: MatConicalGradient:case MatConicalGradient: Executed by:
executed 3 times by 1 test: case MatConicalGradient: Executed by:
| 3 | ||||||||||||||||||||||||
56 | m_material.reset(QQuickShapeGenericMaterialFactory::createConicalGradient(window, this)); | - | ||||||||||||||||||||||||
57 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||||||||||||||
58 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
59 | QMessageLogger(__FILE__, 106, __PRETTY_FUNCTION__).warning("Unknown material %d", m); | - | ||||||||||||||||||||||||
60 | return; never executed: return; | 0 | ||||||||||||||||||||||||
61 | } | - | ||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||
63 | if (material() != m_material.data()
| 0-1360 | ||||||||||||||||||||||||
64 | setMaterial(m_material.data()); executed 1360 times by 1 test: setMaterial(m_material.data()); Executed by:
| 1360 | ||||||||||||||||||||||||
65 | } executed 1360 times by 1 test: end of block Executed by:
| 1360 | ||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | static bool q_supportsElementIndexUint(QSGRendererInterface::GraphicsApi api) | - | ||||||||||||||||||||||||
68 | { | - | ||||||||||||||||||||||||
69 | static bool elementIndexUint = true; | - | ||||||||||||||||||||||||
70 | - | |||||||||||||||||||||||||
71 | if (api == QSGRendererInterface::OpenGL
| 0-937 | ||||||||||||||||||||||||
72 | static bool elementIndexUintChecked = false; | - | ||||||||||||||||||||||||
73 | if (!elementIndexUintChecked
| 2-935 | ||||||||||||||||||||||||
74 | elementIndexUintChecked = true; | - | ||||||||||||||||||||||||
75 | QOpenGLContext *context = QOpenGLContext::currentContext(); | - | ||||||||||||||||||||||||
76 | QScopedPointer<QOpenGLContext> dummyContext; | - | ||||||||||||||||||||||||
77 | QScopedPointer<QOffscreenSurface> dummySurface; | - | ||||||||||||||||||||||||
78 | bool ok = true; | - | ||||||||||||||||||||||||
79 | if (!context
| 0-2 | ||||||||||||||||||||||||
80 | dummyContext.reset(new QOpenGLContext); | - | ||||||||||||||||||||||||
81 | dummyContext->create(); | - | ||||||||||||||||||||||||
82 | context = dummyContext.data(); | - | ||||||||||||||||||||||||
83 | dummySurface.reset(new QOffscreenSurface); | - | ||||||||||||||||||||||||
84 | dummySurface->setFormat(context->format()); | - | ||||||||||||||||||||||||
85 | dummySurface->create(); | - | ||||||||||||||||||||||||
86 | ok = context->makeCurrent(dummySurface.data()); | - | ||||||||||||||||||||||||
87 | } never executed: end of block | 0 | ||||||||||||||||||||||||
88 | if (ok
| 0-2 | ||||||||||||||||||||||||
89 | elementIndexUint = static_cast<QOpenGLExtensions *>(context->functions())->hasOpenGLExtension( | - | ||||||||||||||||||||||||
90 | QOpenGLExtensions::ElementIndexUint); | - | ||||||||||||||||||||||||
91 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
92 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
93 | } executed 937 times by 1 test: end of block Executed by:
| 937 | ||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||
97 | return executed 937 times by 1 test: elementIndexUint;return elementIndexUint; Executed by:
executed 937 times by 1 test: return elementIndexUint; Executed by:
| 937 | ||||||||||||||||||||||||
98 | } | - | ||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | QQuickShapeGenericRenderer::~QQuickShapeGenericRenderer() | - | ||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||
102 | for (ShapePathData &d : m_sp) { | - | ||||||||||||||||||||||||
103 | if (d.pendingFill
| 135-904 | ||||||||||||||||||||||||
104 | d.pendingFill->orphaned = true; executed 904 times by 1 test: d.pendingFill->orphaned = true; Executed by:
| 904 | ||||||||||||||||||||||||
105 | if (d.pendingStroke
| 312-727 | ||||||||||||||||||||||||
106 | d.pendingStroke->orphaned = true; executed 312 times by 1 test: d.pendingStroke->orphaned = true; Executed by:
| 312 | ||||||||||||||||||||||||
107 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
108 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||
109 | - | |||||||||||||||||||||||||
110 | - | |||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||
112 | - | |||||||||||||||||||||||||
113 | void QQuickShapeGenericRenderer::beginSync(int totalCount) | - | ||||||||||||||||||||||||
114 | { | - | ||||||||||||||||||||||||
115 | if (m_sp.count() != totalCount
| 0-83 | ||||||||||||||||||||||||
116 | m_sp.resize(totalCount); | - | ||||||||||||||||||||||||
117 | m_accDirty |= DirtyList; | - | ||||||||||||||||||||||||
118 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||
119 | for (ShapePathData &d : m_sp) | - | ||||||||||||||||||||||||
120 | d.syncDirty = 0; executed 1039 times by 1 test: d.syncDirty = 0; Executed by:
| 1039 | ||||||||||||||||||||||||
121 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||
123 | void QQuickShapeGenericRenderer::setPath(int index, const QQuickPath *path) | - | ||||||||||||||||||||||||
124 | { | - | ||||||||||||||||||||||||
125 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
126 | d.path = path
| 0-1039 | ||||||||||||||||||||||||
127 | d.syncDirty |= DirtyFillGeom | DirtyStrokeGeom; | - | ||||||||||||||||||||||||
128 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||
130 | void QQuickShapeGenericRenderer::setStrokeColor(int index, const QColor &color) | - | ||||||||||||||||||||||||
131 | { | - | ||||||||||||||||||||||||
132 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
133 | d.strokeColor = colorToColor4ub(color); | - | ||||||||||||||||||||||||
134 | d.syncDirty |= DirtyColor; | - | ||||||||||||||||||||||||
135 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
136 | - | |||||||||||||||||||||||||
137 | void QQuickShapeGenericRenderer::setStrokeWidth(int index, qreal w) | - | ||||||||||||||||||||||||
138 | { | - | ||||||||||||||||||||||||
139 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
140 | d.strokeWidth = w; | - | ||||||||||||||||||||||||
141 | if (w >= 0.0f
| 388-651 | ||||||||||||||||||||||||
142 | d.pen.setWidthF(w); executed 388 times by 1 test: d.pen.setWidthF(w); Executed by:
| 388 | ||||||||||||||||||||||||
143 | d.syncDirty |= DirtyStrokeGeom; | - | ||||||||||||||||||||||||
144 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | void QQuickShapeGenericRenderer::setFillColor(int index, const QColor &color) | - | ||||||||||||||||||||||||
147 | { | - | ||||||||||||||||||||||||
148 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
149 | d.fillColor = colorToColor4ub(color); | - | ||||||||||||||||||||||||
150 | d.syncDirty |= DirtyColor; | - | ||||||||||||||||||||||||
151 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
152 | - | |||||||||||||||||||||||||
153 | void QQuickShapeGenericRenderer::setFillRule(int index, QQuickShapePath::FillRule fillRule) | - | ||||||||||||||||||||||||
154 | { | - | ||||||||||||||||||||||||
155 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
156 | d.fillRule = Qt::FillRule(fillRule); | - | ||||||||||||||||||||||||
157 | d.syncDirty |= DirtyFillGeom; | - | ||||||||||||||||||||||||
158 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||
160 | void QQuickShapeGenericRenderer::setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) | - | ||||||||||||||||||||||||
161 | { | - | ||||||||||||||||||||||||
162 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
163 | d.pen.setJoinStyle(Qt::PenJoinStyle(joinStyle)); | - | ||||||||||||||||||||||||
164 | d.pen.setMiterLimit(miterLimit); | - | ||||||||||||||||||||||||
165 | d.syncDirty |= DirtyStrokeGeom; | - | ||||||||||||||||||||||||
166 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||
168 | void QQuickShapeGenericRenderer::setCapStyle(int index, QQuickShapePath::CapStyle capStyle) | - | ||||||||||||||||||||||||
169 | { | - | ||||||||||||||||||||||||
170 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
171 | d.pen.setCapStyle(Qt::PenCapStyle(capStyle)); | - | ||||||||||||||||||||||||
172 | d.syncDirty |= DirtyStrokeGeom; | - | ||||||||||||||||||||||||
173 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
174 | - | |||||||||||||||||||||||||
175 | void QQuickShapeGenericRenderer::setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, | - | ||||||||||||||||||||||||
176 | qreal dashOffset, const QVector<qreal> &dashPattern) | - | ||||||||||||||||||||||||
177 | { | - | ||||||||||||||||||||||||
178 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
179 | d.pen.setStyle(Qt::PenStyle(strokeStyle)); | - | ||||||||||||||||||||||||
180 | if (strokeStyle == QQuickShapePath::DashLine
| 21-1018 | ||||||||||||||||||||||||
181 | d.pen.setDashPattern(dashPattern); | - | ||||||||||||||||||||||||
182 | d.pen.setDashOffset(dashOffset); | - | ||||||||||||||||||||||||
183 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||||||||||||||
184 | d.syncDirty |= DirtyStrokeGeom; | - | ||||||||||||||||||||||||
185 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||
187 | void QQuickShapeGenericRenderer::setFillGradient(int index, QQuickShapeGradient *gradient) | - | ||||||||||||||||||||||||
188 | { | - | ||||||||||||||||||||||||
189 | ShapePathData &d(m_sp[index]); | - | ||||||||||||||||||||||||
190 | if (gradient
| 19-1020 | ||||||||||||||||||||||||
191 | d.fillGradient.stops = gradient->gradientStops(); | - | ||||||||||||||||||||||||
192 | d.fillGradient.spread = gradient->spread(); | - | ||||||||||||||||||||||||
193 | if (QQuickShapeLinearGradient *g = qobject_cast<QQuickShapeLinearGradient *>(gradient)
| 7-12 | ||||||||||||||||||||||||
194 | d.fillGradientActive = LinearGradient; | - | ||||||||||||||||||||||||
195 | d.fillGradient.a = QPointF(g->x1(), g->y1()); | - | ||||||||||||||||||||||||
196 | d.fillGradient.b = QPointF(g->x2(), g->y2()); | - | ||||||||||||||||||||||||
197 | } executed 12 times by 1 test: else if (QQuickShapeRadialGradient *g = qobject_cast<QQuickShapeRadialGradient *>(gradient)end of block Executed by:
| 3-12 | ||||||||||||||||||||||||
198 | d.fillGradientActive = RadialGradient; | - | ||||||||||||||||||||||||
199 | d.fillGradient.a = QPointF(g->centerX(), g->centerY()); | - | ||||||||||||||||||||||||
200 | d.fillGradient.b = QPointF(g->focalX(), g->focalY()); | - | ||||||||||||||||||||||||
201 | d.fillGradient.v0 = g->centerRadius(); | - | ||||||||||||||||||||||||
202 | d.fillGradient.v1 = g->focalRadius(); | - | ||||||||||||||||||||||||
203 | } executed 4 times by 1 test: else if (QQuickShapeConicalGradient *g = qobject_cast<QQuickShapeConicalGradient *>(gradient)end of block Executed by:
| 0-4 | ||||||||||||||||||||||||
204 | d.fillGradientActive = ConicalGradient; | - | ||||||||||||||||||||||||
205 | d.fillGradient.a = QPointF(g->centerX(), g->centerY()); | - | ||||||||||||||||||||||||
206 | d.fillGradient.v0 = g->angle(); | - | ||||||||||||||||||||||||
207 | } executed 3 times by 1 test: else {end of block Executed by:
| 3 | ||||||||||||||||||||||||
208 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 255)); __builtin_unreachable(); } while (false); | - | ||||||||||||||||||||||||
209 | } never executed: end of block | 0 | ||||||||||||||||||||||||
210 | } else { | - | ||||||||||||||||||||||||
211 | d.fillGradientActive = NoGradient; | - | ||||||||||||||||||||||||
212 | } executed 1020 times by 1 test: end of block Executed by:
| 1020 | ||||||||||||||||||||||||
213 | d.syncDirty |= DirtyFillGradient; | - | ||||||||||||||||||||||||
214 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||
216 | void QQuickShapeFillRunnable::run() | - | ||||||||||||||||||||||||
217 | { | - | ||||||||||||||||||||||||
218 | QQuickShapeGenericRenderer::triangulateFill(path, fillColor, &fillVertices, &fillIndices, &indexType, supportsElementIndexUint); | - | ||||||||||||||||||||||||
219 | done(this); | - | ||||||||||||||||||||||||
220 | } executed 904 times by 1 test: end of block Executed by:
| 904 | ||||||||||||||||||||||||
221 | - | |||||||||||||||||||||||||
222 | void QQuickShapeStrokeRunnable::run() | - | ||||||||||||||||||||||||
223 | { | - | ||||||||||||||||||||||||
224 | QQuickShapeGenericRenderer::triangulateStroke(path, pen, strokeColor, &strokeVertices, clipSize); | - | ||||||||||||||||||||||||
225 | done(this); | - | ||||||||||||||||||||||||
226 | } executed 312 times by 1 test: end of block Executed by:
| 312 | ||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||
228 | void QQuickShapeGenericRenderer::setAsyncCallback(void (*callback)(void *), void *data) | - | ||||||||||||||||||||||||
229 | { | - | ||||||||||||||||||||||||
230 | m_asyncCallback = callback; | - | ||||||||||||||||||||||||
231 | m_asyncCallbackData = data; | - | ||||||||||||||||||||||||
232 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||
234 | static QThreadPool *pathWorkThreadPool = nullptr; | - | ||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||
236 | static void deletePathWorkThreadPool() | - | ||||||||||||||||||||||||
237 | { | - | ||||||||||||||||||||||||
238 | delete pathWorkThreadPool; | - | ||||||||||||||||||||||||
239 | pathWorkThreadPool = nullptr; | - | ||||||||||||||||||||||||
240 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||
242 | void QQuickShapeGenericRenderer::endSync(bool async) | - | ||||||||||||||||||||||||
243 | { | - | ||||||||||||||||||||||||
244 | bool didKickOffAsync = false; | - | ||||||||||||||||||||||||
245 | - | |||||||||||||||||||||||||
246 | for (int i = 0; i < m_sp.count()
| 83-1039 | ||||||||||||||||||||||||
247 | ShapePathData &d(m_sp[i]); | - | ||||||||||||||||||||||||
248 | if (!d.syncDirty
| 0-1039 | ||||||||||||||||||||||||
249 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | m_accDirty |= d.syncDirty; | - | ||||||||||||||||||||||||
252 | - | |||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||
257 | - | |||||||||||||||||||||||||
258 | d.effectiveDirty |= d.syncDirty; | - | ||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||
260 | if (d.path.isEmpty()
| 10-1029 | ||||||||||||||||||||||||
261 | d.fillVertices.clear(); | - | ||||||||||||||||||||||||
262 | d.fillIndices.clear(); | - | ||||||||||||||||||||||||
263 | d.strokeVertices.clear(); | - | ||||||||||||||||||||||||
264 | continue; executed 10 times by 1 test: continue; Executed by:
| 10 | ||||||||||||||||||||||||
265 | } | - | ||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | if (async
| 2-956 | ||||||||||||||||||||||||
268 | qAddPostRoutine(deletePathWorkThreadPool); | - | ||||||||||||||||||||||||
269 | pathWorkThreadPool = new QThreadPool; | - | ||||||||||||||||||||||||
270 | const int idealCount = QThread::idealThreadCount(); | - | ||||||||||||||||||||||||
271 | pathWorkThreadPool->setMaxThreadCount(idealCount > 0 ? idealCount * 2 : 4); | - | ||||||||||||||||||||||||
272 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||
274 | if ((
| 0-1029 | ||||||||||||||||||||||||
275 | d.path.setFillRule(d.fillRule); | - | ||||||||||||||||||||||||
276 | if (m_api == QSGRendererInterface::Unknown
| 37-900 | ||||||||||||||||||||||||
277 | m_api = m_item->window()->rendererInterface()->graphicsApi(); executed 37 times by 1 test: m_api = m_item->window()->rendererInterface()->graphicsApi(); Executed by:
| 37 | ||||||||||||||||||||||||
278 | if (async
| 33-904 | ||||||||||||||||||||||||
279 | QQuickShapeFillRunnable *r = new QQuickShapeFillRunnable; | - | ||||||||||||||||||||||||
280 | r->setAutoDelete(false); | - | ||||||||||||||||||||||||
281 | if (d.pendingFill
| 0-904 | ||||||||||||||||||||||||
282 | d.pendingFill->orphaned = true; never executed: d.pendingFill->orphaned = true; | 0 | ||||||||||||||||||||||||
283 | d.pendingFill = r; | - | ||||||||||||||||||||||||
284 | r->path = d.path; | - | ||||||||||||||||||||||||
285 | r->fillColor = d.fillColor; | - | ||||||||||||||||||||||||
286 | r->supportsElementIndexUint = q_supportsElementIndexUint(m_api); | - | ||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||
288 | - | |||||||||||||||||||||||||
289 | QObject::connect(r, &QQuickShapeFillRunnable::done, (static_cast<QGuiApplication *>(QCoreApplication::instance())), [this, i](QQuickShapeFillRunnable *r) { | - | ||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||
292 | if (!r->orphaned
| 0-904 | ||||||||||||||||||||||||
293 | ShapePathData &d(m_sp[i]); | - | ||||||||||||||||||||||||
294 | d.fillVertices = r->fillVertices; | - | ||||||||||||||||||||||||
295 | d.fillIndices = r->fillIndices; | - | ||||||||||||||||||||||||
296 | d.indexType = r->indexType; | - | ||||||||||||||||||||||||
297 | d.pendingFill = nullptr; | - | ||||||||||||||||||||||||
298 | d.effectiveDirty |= DirtyFillGeom; | - | ||||||||||||||||||||||||
299 | maybeUpdateAsyncItem(); | - | ||||||||||||||||||||||||
300 | } never executed: end of block | 0 | ||||||||||||||||||||||||
301 | r->deleteLater(); | - | ||||||||||||||||||||||||
302 | } executed 904 times by 1 test: );end of block Executed by:
| 904 | ||||||||||||||||||||||||
303 | didKickOffAsync = true; | - | ||||||||||||||||||||||||
304 | pathWorkThreadPool->start(r); | - | ||||||||||||||||||||||||
305 | } executed 904 times by 1 test: else {end of block Executed by:
| 904 | ||||||||||||||||||||||||
306 | triangulateFill(d.path, d.fillColor, &d.fillVertices, &d.fillIndices, &d.indexType, q_supportsElementIndexUint(m_api)); | - | ||||||||||||||||||||||||
307 | } executed 33 times by 1 test: end of block Executed by:
| 33 | ||||||||||||||||||||||||
308 | } | - | ||||||||||||||||||||||||
309 | - | |||||||||||||||||||||||||
310 | if ((
| 0-1029 | ||||||||||||||||||||||||
311 | if (async
| 66-312 | ||||||||||||||||||||||||
312 | QQuickShapeStrokeRunnable *r = new QQuickShapeStrokeRunnable; | - | ||||||||||||||||||||||||
313 | r->setAutoDelete(false); | - | ||||||||||||||||||||||||
314 | if (d.pendingStroke
| 0-312 | ||||||||||||||||||||||||
315 | d.pendingStroke->orphaned = true; never executed: d.pendingStroke->orphaned = true; | 0 | ||||||||||||||||||||||||
316 | d.pendingStroke = r; | - | ||||||||||||||||||||||||
317 | r->path = d.path; | - | ||||||||||||||||||||||||
318 | r->pen = d.pen; | - | ||||||||||||||||||||||||
319 | r->strokeColor = d.strokeColor; | - | ||||||||||||||||||||||||
320 | r->clipSize = QSize(m_item->width(), m_item->height()); | - | ||||||||||||||||||||||||
321 | QObject::connect(r, &QQuickShapeStrokeRunnable::done, (static_cast<QGuiApplication *>(QCoreApplication::instance())), [this, i](QQuickShapeStrokeRunnable *r) { | - | ||||||||||||||||||||||||
322 | if (!r->orphaned
| 0-312 | ||||||||||||||||||||||||
323 | ShapePathData &d(m_sp[i]); | - | ||||||||||||||||||||||||
324 | d.strokeVertices = r->strokeVertices; | - | ||||||||||||||||||||||||
325 | d.pendingStroke = nullptr; | - | ||||||||||||||||||||||||
326 | d.effectiveDirty |= DirtyStrokeGeom; | - | ||||||||||||||||||||||||
327 | maybeUpdateAsyncItem(); | - | ||||||||||||||||||||||||
328 | } never executed: end of block | 0 | ||||||||||||||||||||||||
329 | r->deleteLater(); | - | ||||||||||||||||||||||||
330 | } executed 312 times by 1 test: );end of block Executed by:
| 312 | ||||||||||||||||||||||||
331 | didKickOffAsync = true; | - | ||||||||||||||||||||||||
332 | pathWorkThreadPool->start(r); | - | ||||||||||||||||||||||||
333 | } executed 312 times by 1 test: else {end of block Executed by:
| 312 | ||||||||||||||||||||||||
334 | triangulateStroke(d.path, d.pen, d.strokeColor, &d.strokeVertices, | - | ||||||||||||||||||||||||
335 | QSize(m_item->width(), m_item->height())); | - | ||||||||||||||||||||||||
336 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||||||||
337 | } | - | ||||||||||||||||||||||||
338 | } executed 1029 times by 1 test: end of block Executed by:
| 1029 | ||||||||||||||||||||||||
339 | - | |||||||||||||||||||||||||
340 | if (!didKickOffAsync
| 0-79 | ||||||||||||||||||||||||
341 | m_asyncCallback(m_asyncCallbackData); never executed: m_asyncCallback(m_asyncCallbackData); | 0 | ||||||||||||||||||||||||
342 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | void QQuickShapeGenericRenderer::maybeUpdateAsyncItem() | - | ||||||||||||||||||||||||
345 | { | - | ||||||||||||||||||||||||
346 | for (const ShapePathData &d : qAsConst(m_sp)) { | - | ||||||||||||||||||||||||
347 | if (d.pendingFill
| 0 | ||||||||||||||||||||||||
348 | return; never executed: return; | 0 | ||||||||||||||||||||||||
349 | } never executed: end of block | 0 | ||||||||||||||||||||||||
350 | m_accDirty |= DirtyFillGeom | DirtyStrokeGeom; | - | ||||||||||||||||||||||||
351 | m_item->update(); | - | ||||||||||||||||||||||||
352 | if (m_asyncCallback
| 0 | ||||||||||||||||||||||||
353 | m_asyncCallback(m_asyncCallbackData); never executed: m_asyncCallback(m_asyncCallbackData); | 0 | ||||||||||||||||||||||||
354 | } never executed: end of block | 0 | ||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||
356 | - | |||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||
358 | void QQuickShapeGenericRenderer::triangulateFill(const QPainterPath &path, | - | ||||||||||||||||||||||||
359 | const Color4ub &fillColor, | - | ||||||||||||||||||||||||
360 | VertexContainerType *fillVertices, | - | ||||||||||||||||||||||||
361 | IndexContainerType *fillIndices, | - | ||||||||||||||||||||||||
362 | QSGGeometry::Type *indexType, | - | ||||||||||||||||||||||||
363 | bool supportsElementIndexUint) | - | ||||||||||||||||||||||||
364 | { | - | ||||||||||||||||||||||||
365 | const QVectorPath &vp = qtVectorPathForPath(path); | - | ||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||
367 | QTriangleSet ts = qTriangulate(vp, QTransform::fromScale(TRI_SCALE, TRI_SCALE), 1, supportsElementIndexUint); | - | ||||||||||||||||||||||||
368 | const int vertexCount = ts.vertices.count() / 2; | - | ||||||||||||||||||||||||
369 | fillVertices->resize(vertexCount); | - | ||||||||||||||||||||||||
370 | ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(fillVertices->data()); | - | ||||||||||||||||||||||||
371 | const qreal *vsrc = ts.vertices.constData(); | - | ||||||||||||||||||||||||
372 | for (int i = 0; i < vertexCount
| 937-33801 | ||||||||||||||||||||||||
373 | vdst[i].set(vsrc[i * 2] / TRI_SCALE, vsrc[i * 2 + 1] / TRI_SCALE, fillColor); executed 33800 times by 1 test: vdst[i].set(vsrc[i * 2] / TRI_SCALE, vsrc[i * 2 + 1] / TRI_SCALE, fillColor); Executed by:
| 33800 | ||||||||||||||||||||||||
374 | - | |||||||||||||||||||||||||
375 | size_t indexByteSize; | - | ||||||||||||||||||||||||
376 | if (ts.indices.type() == QVertexIndexVector::UnsignedShort
| 0-936 | ||||||||||||||||||||||||
377 | *indexType = QSGGeometry::UnsignedShortType; | - | ||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||
379 | - | |||||||||||||||||||||||||
380 | fillIndices->resize(ts.indices.size() / 2); | - | ||||||||||||||||||||||||
381 | indexByteSize = ts.indices.size() * sizeof(quint16); | - | ||||||||||||||||||||||||
382 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
383 | *indexType = QSGGeometry::UnsignedIntType; | - | ||||||||||||||||||||||||
384 | fillIndices->resize(ts.indices.size()); | - | ||||||||||||||||||||||||
385 | indexByteSize = ts.indices.size() * sizeof(quint32); | - | ||||||||||||||||||||||||
386 | } executed 935 times by 1 test: end of block Executed by:
| 935 | ||||||||||||||||||||||||
387 | memcpy(fillIndices->data(), ts.indices.data(), indexByteSize); | - | ||||||||||||||||||||||||
388 | } executed 935 times by 1 test: end of block Executed by:
| 935 | ||||||||||||||||||||||||
389 | - | |||||||||||||||||||||||||
390 | void QQuickShapeGenericRenderer::triangulateStroke(const QPainterPath &path, | - | ||||||||||||||||||||||||
391 | const QPen &pen, | - | ||||||||||||||||||||||||
392 | const Color4ub &strokeColor, | - | ||||||||||||||||||||||||
393 | VertexContainerType *strokeVertices, | - | ||||||||||||||||||||||||
394 | const QSize &clipSize) | - | ||||||||||||||||||||||||
395 | { | - | ||||||||||||||||||||||||
396 | const QVectorPath &vp = qtVectorPathForPath(path); | - | ||||||||||||||||||||||||
397 | const QRectF clip(QPointF(0, 0), clipSize); | - | ||||||||||||||||||||||||
398 | const qreal inverseScale = 1.0 / TRI_SCALE; | - | ||||||||||||||||||||||||
399 | - | |||||||||||||||||||||||||
400 | QTriangulatingStroker stroker; | - | ||||||||||||||||||||||||
401 | stroker.setInvScale(inverseScale); | - | ||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||
403 | if (pen.style() == Qt::SolidLine
| 21-357 | ||||||||||||||||||||||||
404 | stroker.process(vp, pen, clip, nullptr); | - | ||||||||||||||||||||||||
405 | } executed 357 times by 1 test: else {end of block Executed by:
| 357 | ||||||||||||||||||||||||
406 | QDashedStrokeProcessor dashStroker; | - | ||||||||||||||||||||||||
407 | dashStroker.setInvScale(inverseScale); | - | ||||||||||||||||||||||||
408 | dashStroker.process(vp, pen, clip, nullptr); | - | ||||||||||||||||||||||||
409 | QVectorPath dashStroke(dashStroker.points(), dashStroker.elementCount(), | - | ||||||||||||||||||||||||
410 | dashStroker.elementTypes(), 0); | - | ||||||||||||||||||||||||
411 | stroker.process(dashStroke, pen, clip, nullptr); | - | ||||||||||||||||||||||||
412 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||||||||||||||
413 | - | |||||||||||||||||||||||||
414 | if (!stroker.vertexCount()
| 0-378 | ||||||||||||||||||||||||
415 | strokeVertices->clear(); | - | ||||||||||||||||||||||||
416 | return; never executed: return; | 0 | ||||||||||||||||||||||||
417 | } | - | ||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||
419 | const int vertexCount = stroker.vertexCount() / 2; | - | ||||||||||||||||||||||||
420 | strokeVertices->resize(vertexCount); | - | ||||||||||||||||||||||||
421 | ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(strokeVertices->data()); | - | ||||||||||||||||||||||||
422 | const float *vsrc = stroker.vertices(); | - | ||||||||||||||||||||||||
423 | for (int i = 0; i < vertexCount
| 378-51988 | ||||||||||||||||||||||||
424 | vdst[i].set(vsrc[i * 2], vsrc[i * 2 + 1], strokeColor); executed 51989 times by 1 test: vdst[i].set(vsrc[i * 2], vsrc[i * 2 + 1], strokeColor); Executed by:
| 51989 | ||||||||||||||||||||||||
425 | } executed 378 times by 1 test: end of block Executed by:
| 378 | ||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||
427 | void QQuickShapeGenericRenderer::setRootNode(QQuickShapeGenericNode *node) | - | ||||||||||||||||||||||||
428 | { | - | ||||||||||||||||||||||||
429 | if (m_rootNode != node
| 0-83 | ||||||||||||||||||||||||
430 | m_rootNode = node; | - | ||||||||||||||||||||||||
431 | m_accDirty |= DirtyList; | - | ||||||||||||||||||||||||
432 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||
433 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||
434 | - | |||||||||||||||||||||||||
435 | - | |||||||||||||||||||||||||
436 | void QQuickShapeGenericRenderer::updateNode() | - | ||||||||||||||||||||||||
437 | { | - | ||||||||||||||||||||||||
438 | if (!m_rootNode
| 0-83 | ||||||||||||||||||||||||
439 | return; never executed: return; | 0 | ||||||||||||||||||||||||
440 | QQuickShapeGenericNode **nodePtr = &m_rootNode; | - | ||||||||||||||||||||||||
441 | QQuickShapeGenericNode *prevNode = nullptr; | - | ||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||
443 | for (ShapePathData &d : m_sp) { | - | ||||||||||||||||||||||||
444 | if (!*nodePtr
| 83-956 | ||||||||||||||||||||||||
445 | ((prevNode) ? static_cast<void>(0) : qt_assert("prevNode", __FILE__, 503)); | - | ||||||||||||||||||||||||
446 | *nodePtr = new QQuickShapeGenericNode; | - | ||||||||||||||||||||||||
447 | prevNode->m_next = *nodePtr; | - | ||||||||||||||||||||||||
448 | prevNode->appendChildNode(*nodePtr); | - | ||||||||||||||||||||||||
449 | } executed 956 times by 1 test: end of block Executed by:
| 956 | ||||||||||||||||||||||||
450 | - | |||||||||||||||||||||||||
451 | QQuickShapeGenericNode *node = *nodePtr; | - | ||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||
453 | if (m_accDirty & DirtyList
| 0-1039 | ||||||||||||||||||||||||
454 | d.effectiveDirty |= DirtyFillGeom | DirtyStrokeGeom | DirtyColor | DirtyFillGradient; executed 1039 times by 1 test: d.effectiveDirty |= DirtyFillGeom | DirtyStrokeGeom | DirtyColor | DirtyFillGradient; Executed by:
| 1039 | ||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||
456 | if (!d.effectiveDirty
| 0-1039 | ||||||||||||||||||||||||
457 | prevNode = node; | - | ||||||||||||||||||||||||
458 | nodePtr = &node->m_next; | - | ||||||||||||||||||||||||
459 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
460 | } | - | ||||||||||||||||||||||||
461 | - | |||||||||||||||||||||||||
462 | if (d.fillColor.a == 0
| 96-943 | ||||||||||||||||||||||||
463 | delete node->m_fillNode; | - | ||||||||||||||||||||||||
464 | node->m_fillNode = nullptr; | - | ||||||||||||||||||||||||
465 | } executed 96 times by 1 test: else if (!node->m_fillNodeend of block Executed by:
| 0-943 | ||||||||||||||||||||||||
466 | node->m_fillNode = new QQuickShapeGenericStrokeFillNode(m_item->window()); | - | ||||||||||||||||||||||||
467 | if (node->m_strokeNode
| 0-943 | ||||||||||||||||||||||||
468 | node->removeChildNode(node->m_strokeNode); never executed: node->removeChildNode(node->m_strokeNode); | 0 | ||||||||||||||||||||||||
469 | node->appendChildNode(node->m_fillNode); | - | ||||||||||||||||||||||||
470 | if (node->m_strokeNode
| 0-943 | ||||||||||||||||||||||||
471 | node->appendChildNode(node->m_strokeNode); never executed: node->appendChildNode(node->m_strokeNode); | 0 | ||||||||||||||||||||||||
472 | d.effectiveDirty |= DirtyFillGeom; | - | ||||||||||||||||||||||||
473 | } executed 943 times by 1 test: end of block Executed by:
| 943 | ||||||||||||||||||||||||
474 | - | |||||||||||||||||||||||||
475 | if (d.strokeWidth < 0.0f
| 4-651 | ||||||||||||||||||||||||
476 | delete node->m_strokeNode; | - | ||||||||||||||||||||||||
477 | node->m_strokeNode = nullptr; | - | ||||||||||||||||||||||||
478 | } executed 655 times by 1 test: else if (!node->m_strokeNodeend of block Executed by:
| 0-655 | ||||||||||||||||||||||||
479 | node->m_strokeNode = new QQuickShapeGenericStrokeFillNode(m_item->window()); | - | ||||||||||||||||||||||||
480 | node->appendChildNode(node->m_strokeNode); | - | ||||||||||||||||||||||||
481 | d.effectiveDirty |= DirtyStrokeGeom; | - | ||||||||||||||||||||||||
482 | } executed 384 times by 1 test: end of block Executed by:
| 384 | ||||||||||||||||||||||||
483 | - | |||||||||||||||||||||||||
484 | updateFillNode(&d, node); | - | ||||||||||||||||||||||||
485 | updateStrokeNode(&d, node); | - | ||||||||||||||||||||||||
486 | - | |||||||||||||||||||||||||
487 | d.effectiveDirty = 0; | - | ||||||||||||||||||||||||
488 | - | |||||||||||||||||||||||||
489 | prevNode = node; | - | ||||||||||||||||||||||||
490 | nodePtr = &node->m_next; | - | ||||||||||||||||||||||||
491 | } executed 1039 times by 1 test: end of block Executed by:
| 1039 | ||||||||||||||||||||||||
492 | - | |||||||||||||||||||||||||
493 | if (*
| 0-83 | ||||||||||||||||||||||||
494 | prevNode->removeChildNode(*nodePtr); | - | ||||||||||||||||||||||||
495 | delete *nodePtr; | - | ||||||||||||||||||||||||
496 | *nodePtr = nullptr; | - | ||||||||||||||||||||||||
497 | } never executed: end of block | 0 | ||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||
499 | m_accDirty = 0; | - | ||||||||||||||||||||||||
500 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||
501 | - | |||||||||||||||||||||||||
502 | void QQuickShapeGenericRenderer::updateShadowDataInNode(ShapePathData *d, QQuickShapeGenericStrokeFillNode *n) | - | ||||||||||||||||||||||||
503 | { | - | ||||||||||||||||||||||||
504 | if (d->fillGradientActive
| 19-924 | ||||||||||||||||||||||||
505 | if (d->effectiveDirty & DirtyFillGradient
| 0-19 | ||||||||||||||||||||||||
506 | n->m_fillGradient = d->fillGradient; executed 19 times by 1 test: n->m_fillGradient = d->fillGradient; Executed by:
| 19 | ||||||||||||||||||||||||
507 | } executed 19 times by 1 test: end of block Executed by:
| 19 | ||||||||||||||||||||||||
508 | } executed 943 times by 1 test: end of block Executed by:
| 943 | ||||||||||||||||||||||||
509 | - | |||||||||||||||||||||||||
510 | void QQuickShapeGenericRenderer::updateFillNode(ShapePathData *d, QQuickShapeGenericNode *node) | - | ||||||||||||||||||||||||
511 | { | - | ||||||||||||||||||||||||
512 | if (!node->m_fillNode
| 96-943 | ||||||||||||||||||||||||
513 | return; executed 96 times by 1 test: return; Executed by:
| 96 | ||||||||||||||||||||||||
514 | if (!(d->effectiveDirty & (DirtyFillGeom | DirtyColor | DirtyFillGradient))
| 0-943 | ||||||||||||||||||||||||
515 | return; never executed: return; | 0 | ||||||||||||||||||||||||
516 | - | |||||||||||||||||||||||||
517 | - | |||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||
519 | QQuickShapeGenericStrokeFillNode *n = node->m_fillNode; | - | ||||||||||||||||||||||||
520 | updateShadowDataInNode(d, n); | - | ||||||||||||||||||||||||
521 | - | |||||||||||||||||||||||||
522 | QSGGeometry *g = n->geometry(); | - | ||||||||||||||||||||||||
523 | if (d->fillVertices.isEmpty()
| 33-910 | ||||||||||||||||||||||||
524 | if (g->vertexCount()
| 0-910 | ||||||||||||||||||||||||
525 | g->allocate(0, 0); | - | ||||||||||||||||||||||||
526 | n->markDirty(QSGNode::DirtyGeometry); | - | ||||||||||||||||||||||||
527 | } never executed: end of block | 0 | ||||||||||||||||||||||||
528 | return; executed 910 times by 1 test: return; Executed by:
| 910 | ||||||||||||||||||||||||
529 | } | - | ||||||||||||||||||||||||
530 | - | |||||||||||||||||||||||||
531 | if (d->fillGradientActive
| 14-19 | ||||||||||||||||||||||||
532 | QQuickShapeGenericStrokeFillNode::Material gradMat; | - | ||||||||||||||||||||||||
533 | switch (d->fillGradientActive) { | - | ||||||||||||||||||||||||
534 | case executed 12 times by 1 test: LinearGradient:case LinearGradient: Executed by:
executed 12 times by 1 test: case LinearGradient: Executed by:
| 12 | ||||||||||||||||||||||||
535 | gradMat = QQuickShapeGenericStrokeFillNode::MatLinearGradient; | - | ||||||||||||||||||||||||
536 | break; executed 12 times by 1 test: break; Executed by:
| 12 | ||||||||||||||||||||||||
537 | case executed 4 times by 1 test: RadialGradient:case RadialGradient: Executed by:
executed 4 times by 1 test: case RadialGradient: Executed by:
| 4 | ||||||||||||||||||||||||
538 | gradMat = QQuickShapeGenericStrokeFillNode::MatRadialGradient; | - | ||||||||||||||||||||||||
539 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||
540 | case executed 3 times by 1 test: ConicalGradient:case ConicalGradient: Executed by:
executed 3 times by 1 test: case ConicalGradient: Executed by:
| 3 | ||||||||||||||||||||||||
541 | gradMat = QQuickShapeGenericStrokeFillNode::MatConicalGradient; | - | ||||||||||||||||||||||||
542 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||||||||||||||
543 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
544 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 602)); __builtin_unreachable(); } while (false); | - | ||||||||||||||||||||||||
545 | return; never executed: return; | 0 | ||||||||||||||||||||||||
546 | } | - | ||||||||||||||||||||||||
547 | n->activateMaterial(m_item->window(), gradMat); | - | ||||||||||||||||||||||||
548 | if (d->effectiveDirty & DirtyFillGradient
| 0-19 | ||||||||||||||||||||||||
549 | - | |||||||||||||||||||||||||
550 | n->markDirty(QSGNode::DirtyMaterial); | - | ||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||
552 | if (!(d->effectiveDirty & DirtyFillGeom)
| 0-19 | ||||||||||||||||||||||||
553 | return; never executed: return; | 0 | ||||||||||||||||||||||||
554 | } executed 19 times by 1 test: end of block Executed by:
| 19 | ||||||||||||||||||||||||
555 | } executed 19 times by 1 test: else {end of block Executed by:
| 19 | ||||||||||||||||||||||||
556 | n->activateMaterial(m_item->window(), QQuickShapeGenericStrokeFillNode::MatSolidColor); | - | ||||||||||||||||||||||||
557 | - | |||||||||||||||||||||||||
558 | if ((
| 0-14 | ||||||||||||||||||||||||
559 | ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(g->vertexData()); | - | ||||||||||||||||||||||||
560 | for (int i = 0; i < g->vertexCount()
| 0 | ||||||||||||||||||||||||
561 | vdst[i].set(vdst[i].x, vdst[i].y, d->fillColor); never executed: vdst[i].set(vdst[i].x, vdst[i].y, d->fillColor); | 0 | ||||||||||||||||||||||||
562 | n->markDirty(QSGNode::DirtyGeometry); | - | ||||||||||||||||||||||||
563 | return; never executed: return; | 0 | ||||||||||||||||||||||||
564 | } | - | ||||||||||||||||||||||||
565 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||||||||
566 | - | |||||||||||||||||||||||||
567 | const int indexCount = d->indexType == QSGGeometry::UnsignedShortType
| 0-33 | ||||||||||||||||||||||||
568 | ? d->fillIndices.count() * 2 : d->fillIndices.count(); | - | ||||||||||||||||||||||||
569 | if (g->indexType() != d->indexType
| 0-33 | ||||||||||||||||||||||||
570 | g = new QSGGeometry(QSGGeometry::defaultAttributes_ColoredPoint2D(), | - | ||||||||||||||||||||||||
571 | d->fillVertices.count(), indexCount, d->indexType); | - | ||||||||||||||||||||||||
572 | n->setGeometry(g); | - | ||||||||||||||||||||||||
573 | } executed 33 times by 1 test: else {end of block Executed by:
| 33 | ||||||||||||||||||||||||
574 | g->allocate(d->fillVertices.count(), indexCount); | - | ||||||||||||||||||||||||
575 | } never executed: end of block | 0 | ||||||||||||||||||||||||
576 | g->setDrawingMode(QSGGeometry::DrawTriangles); | - | ||||||||||||||||||||||||
577 | memcpy(g->vertexData(), d->fillVertices.constData(), g->vertexCount() * g->sizeOfVertex()); | - | ||||||||||||||||||||||||
578 | memcpy(g->indexData(), d->fillIndices.constData(), g->indexCount() * g->sizeOfIndex()); | - | ||||||||||||||||||||||||
579 | - | |||||||||||||||||||||||||
580 | n->markDirty(QSGNode::DirtyGeometry); | - | ||||||||||||||||||||||||
581 | } executed 33 times by 1 test: end of block Executed by:
| 33 | ||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||
583 | void QQuickShapeGenericRenderer::updateStrokeNode(ShapePathData *d, QQuickShapeGenericNode *node) | - | ||||||||||||||||||||||||
584 | { | - | ||||||||||||||||||||||||
585 | if (!node->m_strokeNode
| 384-655 | ||||||||||||||||||||||||
586 | return; executed 655 times by 1 test: return; Executed by:
| 655 | ||||||||||||||||||||||||
587 | if (!(d->effectiveDirty & (DirtyStrokeGeom | DirtyColor))
| 0-384 | ||||||||||||||||||||||||
588 | return; never executed: return; | 0 | ||||||||||||||||||||||||
589 | - | |||||||||||||||||||||||||
590 | QQuickShapeGenericStrokeFillNode *n = node->m_strokeNode; | - | ||||||||||||||||||||||||
591 | QSGGeometry *g = n->geometry(); | - | ||||||||||||||||||||||||
592 | if (d->strokeVertices.isEmpty()
| 66-318 | ||||||||||||||||||||||||
593 | if (g->vertexCount()
| 0-318 | ||||||||||||||||||||||||
594 | g->allocate(0, 0); | - | ||||||||||||||||||||||||
595 | n->markDirty(QSGNode::DirtyGeometry); | - | ||||||||||||||||||||||||
596 | } never executed: end of block | 0 | ||||||||||||||||||||||||
597 | return; executed 318 times by 1 test: return; Executed by:
| 318 | ||||||||||||||||||||||||
598 | } | - | ||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||
600 | n->markDirty(QSGNode::DirtyGeometry); | - | ||||||||||||||||||||||||
601 | - | |||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||
603 | - | |||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||
605 | if (!g->vertexCount()
| 0-66 | ||||||||||||||||||||||||
606 | n->markDirty(QSGNode::DirtyMaterial); executed 66 times by 1 test: n->markDirty(QSGNode::DirtyMaterial); Executed by:
| 66 | ||||||||||||||||||||||||
607 | - | |||||||||||||||||||||||||
608 | if ((
| 0-66 | ||||||||||||||||||||||||
609 | ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(g->vertexData()); | - | ||||||||||||||||||||||||
610 | for (int i = 0; i < g->vertexCount()
| 0 | ||||||||||||||||||||||||
611 | vdst[i].set(vdst[i].x, vdst[i].y, d->strokeColor); never executed: vdst[i].set(vdst[i].x, vdst[i].y, d->strokeColor); | 0 | ||||||||||||||||||||||||
612 | return; never executed: return; | 0 | ||||||||||||||||||||||||
613 | } | - | ||||||||||||||||||||||||
614 | - | |||||||||||||||||||||||||
615 | g->allocate(d->strokeVertices.count(), 0); | - | ||||||||||||||||||||||||
616 | g->setDrawingMode(QSGGeometry::DrawTriangleStrip); | - | ||||||||||||||||||||||||
617 | memcpy(g->vertexData(), d->strokeVertices.constData(), g->vertexCount() * g->sizeOfVertex()); | - | ||||||||||||||||||||||||
618 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||
620 | QSGMaterial *QQuickShapeGenericMaterialFactory::createVertexColor(QQuickWindow *window) | - | ||||||||||||||||||||||||
621 | { | - | ||||||||||||||||||||||||
622 | QSGRendererInterface::GraphicsApi api = window->rendererInterface()->graphicsApi(); | - | ||||||||||||||||||||||||
623 | - | |||||||||||||||||||||||||
624 | - | |||||||||||||||||||||||||
625 | if (api == QSGRendererInterface::OpenGL
| 0-1341 | ||||||||||||||||||||||||
626 | return executed 1341 times by 1 test: new QSGVertexColorMaterial;return new QSGVertexColorMaterial; Executed by:
executed 1341 times by 1 test: return new QSGVertexColorMaterial; Executed by:
| 1341 | ||||||||||||||||||||||||
627 | - | |||||||||||||||||||||||||
628 | - | |||||||||||||||||||||||||
629 | QMessageLogger(__FILE__, 687, __PRETTY_FUNCTION__).warning("Vertex-color material: Unsupported graphics API %d", api); | - | ||||||||||||||||||||||||
630 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
631 | } | - | ||||||||||||||||||||||||
632 | - | |||||||||||||||||||||||||
633 | QSGMaterial *QQuickShapeGenericMaterialFactory::createLinearGradient(QQuickWindow *window, | - | ||||||||||||||||||||||||
634 | QQuickShapeGenericStrokeFillNode *node) | - | ||||||||||||||||||||||||
635 | { | - | ||||||||||||||||||||||||
636 | QSGRendererInterface::GraphicsApi api = window->rendererInterface()->graphicsApi(); | - | ||||||||||||||||||||||||
637 | - | |||||||||||||||||||||||||
638 | - | |||||||||||||||||||||||||
639 | if (api == QSGRendererInterface::OpenGL
| 0-12 | ||||||||||||||||||||||||
640 | return executed 12 times by 1 test: new QQuickShapeLinearGradientMaterial(node);return new QQuickShapeLinearGradientMaterial(node); Executed by:
executed 12 times by 1 test: return new QQuickShapeLinearGradientMaterial(node); Executed by:
| 12 | ||||||||||||||||||||||||
641 | - | |||||||||||||||||||||||||
642 | - | |||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||
644 | - | |||||||||||||||||||||||||
645 | QMessageLogger(__FILE__, 703, __PRETTY_FUNCTION__).warning("Linear gradient material: Unsupported graphics API %d", api); | - | ||||||||||||||||||||||||
646 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
647 | } | - | ||||||||||||||||||||||||
648 | - | |||||||||||||||||||||||||
649 | QSGMaterial *QQuickShapeGenericMaterialFactory::createRadialGradient(QQuickWindow *window, | - | ||||||||||||||||||||||||
650 | QQuickShapeGenericStrokeFillNode *node) | - | ||||||||||||||||||||||||
651 | { | - | ||||||||||||||||||||||||
652 | QSGRendererInterface::GraphicsApi api = window->rendererInterface()->graphicsApi(); | - | ||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||
654 | - | |||||||||||||||||||||||||
655 | if (api == QSGRendererInterface::OpenGL
| 0-4 | ||||||||||||||||||||||||
656 | return executed 4 times by 1 test: new QQuickShapeRadialGradientMaterial(node);return new QQuickShapeRadialGradientMaterial(node); Executed by:
executed 4 times by 1 test: return new QQuickShapeRadialGradientMaterial(node); Executed by:
| 4 | ||||||||||||||||||||||||
657 | - | |||||||||||||||||||||||||
658 | - | |||||||||||||||||||||||||
659 | - | |||||||||||||||||||||||||
660 | - | |||||||||||||||||||||||||
661 | QMessageLogger(__FILE__, 719, __PRETTY_FUNCTION__).warning("Radial gradient material: Unsupported graphics API %d", api); | - | ||||||||||||||||||||||||
662 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
663 | } | - | ||||||||||||||||||||||||
664 | - | |||||||||||||||||||||||||
665 | QSGMaterial *QQuickShapeGenericMaterialFactory::createConicalGradient(QQuickWindow *window, | - | ||||||||||||||||||||||||
666 | QQuickShapeGenericStrokeFillNode *node) | - | ||||||||||||||||||||||||
667 | { | - | ||||||||||||||||||||||||
668 | QSGRendererInterface::GraphicsApi api = window->rendererInterface()->graphicsApi(); | - | ||||||||||||||||||||||||
669 | - | |||||||||||||||||||||||||
670 | - | |||||||||||||||||||||||||
671 | if (api == QSGRendererInterface::OpenGL
| 0-3 | ||||||||||||||||||||||||
672 | return executed 3 times by 1 test: new QQuickShapeConicalGradientMaterial(node);return new QQuickShapeConicalGradientMaterial(node); Executed by:
executed 3 times by 1 test: return new QQuickShapeConicalGradientMaterial(node); Executed by:
| 3 | ||||||||||||||||||||||||
673 | - | |||||||||||||||||||||||||
674 | - | |||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||
677 | QMessageLogger(__FILE__, 735, __PRETTY_FUNCTION__).warning("Conical gradient material: Unsupported graphics API %d", api); | - | ||||||||||||||||||||||||
678 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
679 | } | - | ||||||||||||||||||||||||
680 | - | |||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||
682 | - | |||||||||||||||||||||||||
683 | QSGMaterialType QQuickShapeLinearGradientShader::type; | - | ||||||||||||||||||||||||
684 | - | |||||||||||||||||||||||||
685 | QQuickShapeLinearGradientShader::QQuickShapeLinearGradientShader() | - | ||||||||||||||||||||||||
686 | { | - | ||||||||||||||||||||||||
687 | setShaderSourceFile(QOpenGLShader::Vertex, | - | ||||||||||||||||||||||||
688 | ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/shapes/shaders/lineargradient.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/shapes/shaders/lineargradient.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 8 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 8 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 8 | ||||||||||||||||||||||||
689 | setShaderSourceFile(QOpenGLShader::Fragment, | - | ||||||||||||||||||||||||
690 | ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/shapes/shaders/lineargradient.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/shapes/shaders/lineargradient.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 8 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 8 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 8 | ||||||||||||||||||||||||
691 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
692 | - | |||||||||||||||||||||||||
693 | void QQuickShapeLinearGradientShader::initialize() | - | ||||||||||||||||||||||||
694 | { | - | ||||||||||||||||||||||||
695 | m_opacityLoc = program()->uniformLocation("opacity"); | - | ||||||||||||||||||||||||
696 | m_matrixLoc = program()->uniformLocation("matrix"); | - | ||||||||||||||||||||||||
697 | m_gradStartLoc = program()->uniformLocation("gradStart"); | - | ||||||||||||||||||||||||
698 | m_gradEndLoc = program()->uniformLocation("gradEnd"); | - | ||||||||||||||||||||||||
699 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
700 | - | |||||||||||||||||||||||||
701 | void QQuickShapeLinearGradientShader::updateState(const RenderState &state, QSGMaterial *mat, QSGMaterial *) | - | ||||||||||||||||||||||||
702 | { | - | ||||||||||||||||||||||||
703 | QQuickShapeLinearGradientMaterial *m = static_cast<QQuickShapeLinearGradientMaterial *>(mat); | - | ||||||||||||||||||||||||
704 | - | |||||||||||||||||||||||||
705 | if (state.isOpacityDirty()
| 0-8 | ||||||||||||||||||||||||
706 | program()->setUniformValue(m_opacityLoc, state.opacity()); executed 8 times by 1 test: program()->setUniformValue(m_opacityLoc, state.opacity()); Executed by:
| 8 | ||||||||||||||||||||||||
707 | - | |||||||||||||||||||||||||
708 | if (state.isMatrixDirty()
| 0-8 | ||||||||||||||||||||||||
709 | program()->setUniformValue(m_matrixLoc, state.combinedMatrix()); executed 8 times by 1 test: program()->setUniformValue(m_matrixLoc, state.combinedMatrix()); Executed by:
| 8 | ||||||||||||||||||||||||
710 | - | |||||||||||||||||||||||||
711 | QQuickShapeGenericStrokeFillNode *node = m->node(); | - | ||||||||||||||||||||||||
712 | program()->setUniformValue(m_gradStartLoc, QVector2D(node->m_fillGradient.a)); | - | ||||||||||||||||||||||||
713 | program()->setUniformValue(m_gradEndLoc, QVector2D(node->m_fillGradient.b)); | - | ||||||||||||||||||||||||
714 | - | |||||||||||||||||||||||||
715 | const QQuickShapeGradientCache::Key cacheKey(node->m_fillGradient.stops, node->m_fillGradient.spread); | - | ||||||||||||||||||||||||
716 | QSGTexture *tx = QQuickShapeGradientCache::currentCache()->get(cacheKey); | - | ||||||||||||||||||||||||
717 | tx->bind(); | - | ||||||||||||||||||||||||
718 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
719 | - | |||||||||||||||||||||||||
720 | char const *const *QQuickShapeLinearGradientShader::attributeNames() const | - | ||||||||||||||||||||||||
721 | { | - | ||||||||||||||||||||||||
722 | static const char *const attr[] = { "vertexCoord", "vertexColor", nullptr }; | - | ||||||||||||||||||||||||
723 | return executed 32 times by 1 test: attr;return attr; Executed by:
executed 32 times by 1 test: return attr; Executed by:
| 32 | ||||||||||||||||||||||||
724 | } | - | ||||||||||||||||||||||||
725 | - | |||||||||||||||||||||||||
726 | int QQuickShapeLinearGradientMaterial::compare(const QSGMaterial *other) const | - | ||||||||||||||||||||||||
727 | { | - | ||||||||||||||||||||||||
728 | ((other && type() == other->type()) ? static_cast<void>(0) : qt_assert("other && type() == other->type()", __FILE__, 786)); | - | ||||||||||||||||||||||||
729 | const QQuickShapeLinearGradientMaterial *m = static_cast<const QQuickShapeLinearGradientMaterial *>(other); | - | ||||||||||||||||||||||||
730 | - | |||||||||||||||||||||||||
731 | QQuickShapeGenericStrokeFillNode *a = node(); | - | ||||||||||||||||||||||||
732 | QQuickShapeGenericStrokeFillNode *b = m->node(); | - | ||||||||||||||||||||||||
733 | ((a && b) ? static_cast<void>(0) : qt_assert("a && b", __FILE__, 791)); | - | ||||||||||||||||||||||||
734 | if (a == b
| 0 | ||||||||||||||||||||||||
735 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
736 | - | |||||||||||||||||||||||||
737 | const QQuickAbstractPathRenderer::GradientDesc *ga = &a->m_fillGradient; | - | ||||||||||||||||||||||||
738 | const QQuickAbstractPathRenderer::GradientDesc *gb = &b->m_fillGradient; | - | ||||||||||||||||||||||||
739 | - | |||||||||||||||||||||||||
740 | if (int d = ga->spread - gb->spread
| 0 | ||||||||||||||||||||||||
741 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
742 | - | |||||||||||||||||||||||||
743 | if (int d = ga->a.x() - gb->a.x()
| 0 | ||||||||||||||||||||||||
744 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
745 | if (int d = ga->a.y() - gb->a.y()
| 0 | ||||||||||||||||||||||||
746 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
747 | if (int d = ga->b.x() - gb->b.x()
| 0 | ||||||||||||||||||||||||
748 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
749 | if (int d = ga->b.y() - gb->b.y()
| 0 | ||||||||||||||||||||||||
750 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
751 | - | |||||||||||||||||||||||||
752 | if (int d = ga->stops.count() - gb->stops.count()
| 0 | ||||||||||||||||||||||||
753 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
754 | - | |||||||||||||||||||||||||
755 | for (int i = 0; i < ga->stops.count()
| 0 | ||||||||||||||||||||||||
756 | if (int d = ga->stops[i].first - gb->stops[i].first
| 0 | ||||||||||||||||||||||||
757 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
758 | if (int d = ga->stops[i].second.rgba() - gb->stops[i].second.rgba()
| 0 | ||||||||||||||||||||||||
759 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
760 | } never executed: end of block | 0 | ||||||||||||||||||||||||
761 | - | |||||||||||||||||||||||||
762 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
763 | } | - | ||||||||||||||||||||||||
764 | - | |||||||||||||||||||||||||
765 | QSGMaterialType QQuickShapeRadialGradientShader::type; | - | ||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||
767 | QQuickShapeRadialGradientShader::QQuickShapeRadialGradientShader() | - | ||||||||||||||||||||||||
768 | { | - | ||||||||||||||||||||||||
769 | setShaderSourceFile(QOpenGLShader::Vertex, | - | ||||||||||||||||||||||||
770 | ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/shapes/shaders/radialgradient.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/shapes/shaders/radialgradient.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 4 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 4 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 4 | ||||||||||||||||||||||||
771 | setShaderSourceFile(QOpenGLShader::Fragment, | - | ||||||||||||||||||||||||
772 | ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/shapes/shaders/radialgradient.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/shapes/shaders/radialgradient.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 4 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 4 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 4 | ||||||||||||||||||||||||
773 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
774 | - | |||||||||||||||||||||||||
775 | void QQuickShapeRadialGradientShader::initialize() | - | ||||||||||||||||||||||||
776 | { | - | ||||||||||||||||||||||||
777 | QOpenGLShaderProgram *prog = program(); | - | ||||||||||||||||||||||||
778 | m_opacityLoc = prog->uniformLocation("opacity"); | - | ||||||||||||||||||||||||
779 | m_matrixLoc = prog->uniformLocation("matrix"); | - | ||||||||||||||||||||||||
780 | m_translationPointLoc = prog->uniformLocation("translationPoint"); | - | ||||||||||||||||||||||||
781 | m_focalToCenterLoc = prog->uniformLocation("focalToCenter"); | - | ||||||||||||||||||||||||
782 | m_centerRadiusLoc = prog->uniformLocation("centerRadius"); | - | ||||||||||||||||||||||||
783 | m_focalRadiusLoc = prog->uniformLocation("focalRadius"); | - | ||||||||||||||||||||||||
784 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||
786 | void QQuickShapeRadialGradientShader::updateState(const RenderState &state, QSGMaterial *mat, QSGMaterial *) | - | ||||||||||||||||||||||||
787 | { | - | ||||||||||||||||||||||||
788 | QQuickShapeRadialGradientMaterial *m = static_cast<QQuickShapeRadialGradientMaterial *>(mat); | - | ||||||||||||||||||||||||
789 | - | |||||||||||||||||||||||||
790 | if (state.isOpacityDirty()
| 0-4 | ||||||||||||||||||||||||
791 | program()->setUniformValue(m_opacityLoc, state.opacity()); executed 4 times by 1 test: program()->setUniformValue(m_opacityLoc, state.opacity()); Executed by:
| 4 | ||||||||||||||||||||||||
792 | - | |||||||||||||||||||||||||
793 | if (state.isMatrixDirty()
| 0-4 | ||||||||||||||||||||||||
794 | program()->setUniformValue(m_matrixLoc, state.combinedMatrix()); executed 4 times by 1 test: program()->setUniformValue(m_matrixLoc, state.combinedMatrix()); Executed by:
| 4 | ||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||
796 | QQuickShapeGenericStrokeFillNode *node = m->node(); | - | ||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||
798 | const QPointF centerPoint = node->m_fillGradient.a; | - | ||||||||||||||||||||||||
799 | const QPointF focalPoint = node->m_fillGradient.b; | - | ||||||||||||||||||||||||
800 | const QPointF focalToCenter = centerPoint - focalPoint; | - | ||||||||||||||||||||||||
801 | const GLfloat centerRadius = node->m_fillGradient.v0; | - | ||||||||||||||||||||||||
802 | const GLfloat focalRadius = node->m_fillGradient.v1; | - | ||||||||||||||||||||||||
803 | - | |||||||||||||||||||||||||
804 | program()->setUniformValue(m_translationPointLoc, focalPoint); | - | ||||||||||||||||||||||||
805 | program()->setUniformValue(m_centerRadiusLoc, centerRadius); | - | ||||||||||||||||||||||||
806 | program()->setUniformValue(m_focalRadiusLoc, focalRadius); | - | ||||||||||||||||||||||||
807 | program()->setUniformValue(m_focalToCenterLoc, focalToCenter); | - | ||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||
809 | const QQuickShapeGradientCache::Key cacheKey(node->m_fillGradient.stops, node->m_fillGradient.spread); | - | ||||||||||||||||||||||||
810 | QSGTexture *tx = QQuickShapeGradientCache::currentCache()->get(cacheKey); | - | ||||||||||||||||||||||||
811 | tx->bind(); | - | ||||||||||||||||||||||||
812 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||
814 | char const *const *QQuickShapeRadialGradientShader::attributeNames() const | - | ||||||||||||||||||||||||
815 | { | - | ||||||||||||||||||||||||
816 | static const char *const attr[] = { "vertexCoord", "vertexColor", nullptr }; | - | ||||||||||||||||||||||||
817 | return executed 16 times by 1 test: attr;return attr; Executed by:
executed 16 times by 1 test: return attr; Executed by:
| 16 | ||||||||||||||||||||||||
818 | } | - | ||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||
820 | int QQuickShapeRadialGradientMaterial::compare(const QSGMaterial *other) const | - | ||||||||||||||||||||||||
821 | { | - | ||||||||||||||||||||||||
822 | ((other && type() == other->type()) ? static_cast<void>(0) : qt_assert("other && type() == other->type()", __FILE__, 880)); | - | ||||||||||||||||||||||||
823 | const QQuickShapeRadialGradientMaterial *m = static_cast<const QQuickShapeRadialGradientMaterial *>(other); | - | ||||||||||||||||||||||||
824 | - | |||||||||||||||||||||||||
825 | QQuickShapeGenericStrokeFillNode *a = node(); | - | ||||||||||||||||||||||||
826 | QQuickShapeGenericStrokeFillNode *b = m->node(); | - | ||||||||||||||||||||||||
827 | ((a && b) ? static_cast<void>(0) : qt_assert("a && b", __FILE__, 885)); | - | ||||||||||||||||||||||||
828 | if (a == b
| 0 | ||||||||||||||||||||||||
829 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
830 | - | |||||||||||||||||||||||||
831 | const QQuickAbstractPathRenderer::GradientDesc *ga = &a->m_fillGradient; | - | ||||||||||||||||||||||||
832 | const QQuickAbstractPathRenderer::GradientDesc *gb = &b->m_fillGradient; | - | ||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||
834 | if (int d = ga->spread - gb->spread
| 0 | ||||||||||||||||||||||||
835 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
836 | - | |||||||||||||||||||||||||
837 | if (int d = ga->a.x() - gb->a.x()
| 0 | ||||||||||||||||||||||||
838 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
839 | if (int d = ga->a.y() - gb->a.y()
| 0 | ||||||||||||||||||||||||
840 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
841 | if (int d = ga->b.x() - gb->b.x()
| 0 | ||||||||||||||||||||||||
842 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
843 | if (int d = ga->b.y() - gb->b.y()
| 0 | ||||||||||||||||||||||||
844 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
845 | - | |||||||||||||||||||||||||
846 | if (int d = ga->v0 - gb->v0
| 0 | ||||||||||||||||||||||||
847 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
848 | if (int d = ga->v1 - gb->v1
| 0 | ||||||||||||||||||||||||
849 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
850 | - | |||||||||||||||||||||||||
851 | if (int d = ga->stops.count() - gb->stops.count()
| 0 | ||||||||||||||||||||||||
852 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
853 | - | |||||||||||||||||||||||||
854 | for (int i = 0; i < ga->stops.count()
| 0 | ||||||||||||||||||||||||
855 | if (int d = ga->stops[i].first - gb->stops[i].first
| 0 | ||||||||||||||||||||||||
856 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
857 | if (int d = ga->stops[i].second.rgba() - gb->stops[i].second.rgba()
| 0 | ||||||||||||||||||||||||
858 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
859 | } never executed: end of block | 0 | ||||||||||||||||||||||||
860 | - | |||||||||||||||||||||||||
861 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
862 | } | - | ||||||||||||||||||||||||
863 | - | |||||||||||||||||||||||||
864 | QSGMaterialType QQuickShapeConicalGradientShader::type; | - | ||||||||||||||||||||||||
865 | - | |||||||||||||||||||||||||
866 | QQuickShapeConicalGradientShader::QQuickShapeConicalGradientShader() | - | ||||||||||||||||||||||||
867 | { | - | ||||||||||||||||||||||||
868 | setShaderSourceFile(QOpenGLShader::Vertex, | - | ||||||||||||||||||||||||
869 | ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/shapes/shaders/conicalgradient.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/shapes/shaders/conicalgradient.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 3 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 3 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 3 | ||||||||||||||||||||||||
870 | setShaderSourceFile(QOpenGLShader::Fragment, | - | ||||||||||||||||||||||||
871 | ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/shapes/shaders/conicalgradient.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/shapes/shaders/conicalgradient.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 3 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 3 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 3 | ||||||||||||||||||||||||
872 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||
873 | - | |||||||||||||||||||||||||
874 | void QQuickShapeConicalGradientShader::initialize() | - | ||||||||||||||||||||||||
875 | { | - | ||||||||||||||||||||||||
876 | QOpenGLShaderProgram *prog = program(); | - | ||||||||||||||||||||||||
877 | m_opacityLoc = prog->uniformLocation("opacity"); | - | ||||||||||||||||||||||||
878 | m_matrixLoc = prog->uniformLocation("matrix"); | - | ||||||||||||||||||||||||
879 | m_angleLoc = prog->uniformLocation("angle"); | - | ||||||||||||||||||||||||
880 | m_translationPointLoc = prog->uniformLocation("translationPoint"); | - | ||||||||||||||||||||||||
881 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||
882 | - | |||||||||||||||||||||||||
883 | void QQuickShapeConicalGradientShader::updateState(const RenderState &state, QSGMaterial *mat, QSGMaterial *) | - | ||||||||||||||||||||||||
884 | { | - | ||||||||||||||||||||||||
885 | QQuickShapeConicalGradientMaterial *m = static_cast<QQuickShapeConicalGradientMaterial *>(mat); | - | ||||||||||||||||||||||||
886 | - | |||||||||||||||||||||||||
887 | if (state.isOpacityDirty()
| 0-3 | ||||||||||||||||||||||||
888 | program()->setUniformValue(m_opacityLoc, state.opacity()); executed 3 times by 1 test: program()->setUniformValue(m_opacityLoc, state.opacity()); Executed by:
| 3 | ||||||||||||||||||||||||
889 | - | |||||||||||||||||||||||||
890 | if (state.isMatrixDirty()
| 0-3 | ||||||||||||||||||||||||
891 | program()->setUniformValue(m_matrixLoc, state.combinedMatrix()); executed 3 times by 1 test: program()->setUniformValue(m_matrixLoc, state.combinedMatrix()); Executed by:
| 3 | ||||||||||||||||||||||||
892 | - | |||||||||||||||||||||||||
893 | QQuickShapeGenericStrokeFillNode *node = m->node(); | - | ||||||||||||||||||||||||
894 | - | |||||||||||||||||||||||||
895 | const QPointF centerPoint = node->m_fillGradient.a; | - | ||||||||||||||||||||||||
896 | const GLfloat angle = -qDegreesToRadians(node->m_fillGradient.v0); | - | ||||||||||||||||||||||||
897 | - | |||||||||||||||||||||||||
898 | program()->setUniformValue(m_angleLoc, angle); | - | ||||||||||||||||||||||||
899 | program()->setUniformValue(m_translationPointLoc, centerPoint); | - | ||||||||||||||||||||||||
900 | - | |||||||||||||||||||||||||
901 | const QQuickShapeGradientCache::Key cacheKey(node->m_fillGradient.stops, QQuickShapeGradient::RepeatSpread); | - | ||||||||||||||||||||||||
902 | QSGTexture *tx = QQuickShapeGradientCache::currentCache()->get(cacheKey); | - | ||||||||||||||||||||||||
903 | tx->bind(); | - | ||||||||||||||||||||||||
904 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||
905 | - | |||||||||||||||||||||||||
906 | char const *const *QQuickShapeConicalGradientShader::attributeNames() const | - | ||||||||||||||||||||||||
907 | { | - | ||||||||||||||||||||||||
908 | static const char *const attr[] = { "vertexCoord", "vertexColor", nullptr }; | - | ||||||||||||||||||||||||
909 | return executed 12 times by 1 test: attr;return attr; Executed by:
executed 12 times by 1 test: return attr; Executed by:
| 12 | ||||||||||||||||||||||||
910 | } | - | ||||||||||||||||||||||||
911 | - | |||||||||||||||||||||||||
912 | int QQuickShapeConicalGradientMaterial::compare(const QSGMaterial *other) const | - | ||||||||||||||||||||||||
913 | { | - | ||||||||||||||||||||||||
914 | ((other && type() == other->type()) ? static_cast<void>(0) : qt_assert("other && type() == other->type()", __FILE__, 972)); | - | ||||||||||||||||||||||||
915 | const QQuickShapeConicalGradientMaterial *m = static_cast<const QQuickShapeConicalGradientMaterial *>(other); | - | ||||||||||||||||||||||||
916 | - | |||||||||||||||||||||||||
917 | QQuickShapeGenericStrokeFillNode *a = node(); | - | ||||||||||||||||||||||||
918 | QQuickShapeGenericStrokeFillNode *b = m->node(); | - | ||||||||||||||||||||||||
919 | ((a && b) ? static_cast<void>(0) : qt_assert("a && b", __FILE__, 977)); | - | ||||||||||||||||||||||||
920 | if (a == b
| 0 | ||||||||||||||||||||||||
921 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
922 | - | |||||||||||||||||||||||||
923 | const QQuickAbstractPathRenderer::GradientDesc *ga = &a->m_fillGradient; | - | ||||||||||||||||||||||||
924 | const QQuickAbstractPathRenderer::GradientDesc *gb = &b->m_fillGradient; | - | ||||||||||||||||||||||||
925 | - | |||||||||||||||||||||||||
926 | if (int d = ga->a.x() - gb->a.x()
| 0 | ||||||||||||||||||||||||
927 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
928 | if (int d = ga->a.y() - gb->a.y()
| 0 | ||||||||||||||||||||||||
929 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||
931 | if (int d = ga->v0 - gb->v0
| 0 | ||||||||||||||||||||||||
932 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
933 | - | |||||||||||||||||||||||||
934 | if (int d = ga->stops.count() - gb->stops.count()
| 0 | ||||||||||||||||||||||||
935 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
936 | - | |||||||||||||||||||||||||
937 | for (int i = 0; i < ga->stops.count()
| 0 | ||||||||||||||||||||||||
938 | if (int d = ga->stops[i].first - gb->stops[i].first
| 0 | ||||||||||||||||||||||||
939 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
940 | if (int d = ga->stops[i].second.rgba() - gb->stops[i].second.rgba()
| 0 | ||||||||||||||||||||||||
941 | return never executed: d;return d; never executed: return d; | 0 | ||||||||||||||||||||||||
942 | } never executed: end of block | 0 | ||||||||||||||||||||||||
943 | - | |||||||||||||||||||||||||
944 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
945 | } | - | ||||||||||||||||||||||||
946 | - | |||||||||||||||||||||||||
947 | - | |||||||||||||||||||||||||
948 | - | |||||||||||||||||||||||||
949 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |