OpenCoverage

qquickshapesoftwarerenderer.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickshapes/qquickshapesoftwarerenderer.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4void QQuickShapeSoftwareRenderer::beginSync(int totalCount)-
5{-
6 if (m_sp.count() != totalCount
m_sp.count() != totalCountDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
) {
0-8
7 m_sp.resize(totalCount);-
8 m_accDirty |= DirtyList;-
9 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
10}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
11-
12void QQuickShapeSoftwareRenderer::setPath(int index, const QQuickPath *path)-
13{-
14 ShapePathGuiData &d(m_sp[index]);-
15 d.path = path
pathDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
? path->path() : QPainterPath();
0-12
16 d.dirty |= DirtyPath;-
17 m_accDirty |= DirtyPath;-
18}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
19-
20void QQuickShapeSoftwareRenderer::setStrokeColor(int index, const QColor &color)-
21{-
22 ShapePathGuiData &d(m_sp[index]);-
23 d.pen.setColor(color);-
24 d.dirty |= DirtyPen;-
25 m_accDirty |= DirtyPen;-
26}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
27-
28void QQuickShapeSoftwareRenderer::setStrokeWidth(int index, qreal w)-
29{-
30 ShapePathGuiData &d(m_sp[index]);-
31 d.strokeWidth = w;-
32 if (w >= 0.0f
w >= 0.0fDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
)
0-12
33 d.pen.setWidthF(w);
executed 12 times by 1 test: d.pen.setWidthF(w);
Executed by:
  • tst_qquickshape
12
34 d.dirty |= DirtyPen;-
35 m_accDirty |= DirtyPen;-
36}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
37-
38void QQuickShapeSoftwareRenderer::setFillColor(int index, const QColor &color)-
39{-
40 ShapePathGuiData &d(m_sp[index]);-
41 d.fillColor = color;-
42 d.brush.setColor(color);-
43 d.dirty |= DirtyBrush;-
44 m_accDirty |= DirtyBrush;-
45}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
46-
47void QQuickShapeSoftwareRenderer::setFillRule(int index, QQuickShapePath::FillRule fillRule)-
48{-
49 ShapePathGuiData &d(m_sp[index]);-
50 d.fillRule = Qt::FillRule(fillRule);-
51 d.dirty |= DirtyFillRule;-
52 m_accDirty |= DirtyFillRule;-
53}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
54-
55void QQuickShapeSoftwareRenderer::setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)-
56{-
57 ShapePathGuiData &d(m_sp[index]);-
58 d.pen.setJoinStyle(Qt::PenJoinStyle(joinStyle));-
59 d.pen.setMiterLimit(miterLimit);-
60 d.dirty |= DirtyPen;-
61 m_accDirty |= DirtyPen;-
62}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
63-
64void QQuickShapeSoftwareRenderer::setCapStyle(int index, QQuickShapePath::CapStyle capStyle)-
65{-
66 ShapePathGuiData &d(m_sp[index]);-
67 d.pen.setCapStyle(Qt::PenCapStyle(capStyle));-
68 d.dirty |= DirtyPen;-
69 m_accDirty |= DirtyPen;-
70}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
71-
72void QQuickShapeSoftwareRenderer::setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,-
73 qreal dashOffset, const QVector<qreal> &dashPattern)-
74{-
75 ShapePathGuiData &d(m_sp[index]);-
76 switch (strokeStyle) {-
77 case
executed 6 times by 1 test: case QQuickShapePath::SolidLine:
Executed by:
  • tst_qquickshape
QQuickShapePath::SolidLine:
executed 6 times by 1 test: case QQuickShapePath::SolidLine:
Executed by:
  • tst_qquickshape
6
78 d.pen.setStyle(Qt::SolidLine);-
79 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_qquickshape
6
80 case
executed 6 times by 1 test: case QQuickShapePath::DashLine:
Executed by:
  • tst_qquickshape
QQuickShapePath::DashLine:
executed 6 times by 1 test: case QQuickShapePath::DashLine:
Executed by:
  • tst_qquickshape
6
81 d.pen.setStyle(Qt::CustomDashLine);-
82 d.pen.setDashPattern(dashPattern);-
83 d.pen.setDashOffset(dashOffset);-
84 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_qquickshape
6
85 default
never executed: default:
:
never executed: default:
0
86 break;
never executed: break;
0
87 }-
88 d.dirty |= DirtyPen;-
89 m_accDirty |= DirtyPen;-
90}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
91-
92static inline void setupPainterGradient(QGradient *painterGradient, const QQuickShapeGradient &g)-
93{-
94 painterGradient->setStops(g.gradientStops());-
95 switch (g.spread()) {-
96 case
executed 8 times by 1 test: case QQuickShapeGradient::PadSpread:
Executed by:
  • tst_qquickshape
QQuickShapeGradient::PadSpread:
executed 8 times by 1 test: case QQuickShapeGradient::PadSpread:
Executed by:
  • tst_qquickshape
8
97 painterGradient->setSpread(QGradient::PadSpread);-
98 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquickshape
8
99 case
never executed: case QQuickShapeGradient::RepeatSpread:
QQuickShapeGradient::RepeatSpread:
never executed: case QQuickShapeGradient::RepeatSpread:
0
100 painterGradient->setSpread(QGradient::RepeatSpread);-
101 break;
never executed: break;
0
102 case
never executed: case QQuickShapeGradient::ReflectSpread:
QQuickShapeGradient::ReflectSpread:
never executed: case QQuickShapeGradient::ReflectSpread:
0
103 painterGradient->setSpread(QGradient::ReflectSpread);-
104 break;
never executed: break;
0
105 default
never executed: default:
:
never executed: default:
0
106 break;
never executed: break;
0
107 }-
108}-
109-
110void QQuickShapeSoftwareRenderer::setFillGradient(int index, QQuickShapeGradient *gradient)-
111{-
112 ShapePathGuiData &d(m_sp[index]);-
113 if (QQuickShapeLinearGradient *g = qobject_cast<QQuickShapeLinearGradient *>(gradient)
QQuickShapeLin...t *>(gradient)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
4-8
114 QLinearGradient painterGradient(g->x1(), g->y1(), g->x2(), g->y2());-
115 setupPainterGradient(&painterGradient, *g);-
116 d.brush = QBrush(painterGradient);-
117 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickshape
else if (QQuickShapeRadialGradient *g = qobject_cast<QQuickShapeRadialGradient *>(gradient)
QQuickShapeRad...t *>(gradient)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
2-6
118 QRadialGradient painterGradient(g->centerX(), g->centerY(), g->centerRadius(),-
119 g->focalX(), g->focalY(), g->focalRadius());-
120 setupPainterGradient(&painterGradient, *g);-
121 d.brush = QBrush(painterGradient);-
122 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickshape
else if (QQuickShapeConicalGradient *g = qobject_cast<QQuickShapeConicalGradient *>(gradient)
QQuickShapeCon...t *>(gradient)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
2-4
123 QConicalGradient painterGradient(g->centerX(), g->centerY(), g->angle());-
124 setupPainterGradient(&painterGradient, *g);-
125 d.brush = QBrush(painterGradient);-
126 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickshape
else {
2
127 d.brush = QBrush(d.fillColor);-
128 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickshape
4
129 d.dirty |= DirtyBrush;-
130 m_accDirty |= DirtyBrush;-
131}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
132-
133void QQuickShapeSoftwareRenderer::endSync(bool)-
134{-
135}-
136-
137void QQuickShapeSoftwareRenderer::setNode(QQuickShapeSoftwareRenderNode *node)-
138{-
139 if (m_node != node
m_node != nodeDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
) {
0-8
140 m_node = node;-
141 m_accDirty |= DirtyList;-
142 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
143}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
144-
145void QQuickShapeSoftwareRenderer::updateNode()-
146{-
147 if (!m_accDirty
!m_accDirtyDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-8
148 return;
never executed: return;
0
149-
150 const int count = m_sp.count();-
151 const bool listChanged = m_accDirty & DirtyList;-
152 if (listChanged
listChangedDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
)
0-8
153 m_node->m_sp.resize(count);
executed 8 times by 1 test: m_node->m_sp.resize(count);
Executed by:
  • tst_qquickshape
8
154-
155 m_node->m_boundingRect = QRectF();-
156-
157 for (int i = 0; i < count
i < countDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
; ++i) {
8-12
158 ShapePathGuiData &src(m_sp[i]);-
159 QQuickShapeSoftwareRenderNode::ShapePathRenderData &dst(m_node->m_sp[i]);-
160-
161 if (listChanged
listChangedDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
|| (
(src.dirty & DirtyPath)Description
TRUEnever evaluated
FALSEnever evaluated
src.dirty & DirtyPath)
(src.dirty & DirtyPath)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-12
162 dst.path = src.path;-
163 dst.path.setFillRule(src.fillRule);-
164 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
165-
166 if (listChanged
listChangedDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
|| (
(src.dirty & DirtyFillRule)Description
TRUEnever evaluated
FALSEnever evaluated
src.dirty & DirtyFillRule)
(src.dirty & DirtyFillRule)Description
TRUEnever evaluated
FALSEnever evaluated
)
0-12
167 dst.path.setFillRule(src.fillRule);
executed 12 times by 1 test: dst.path.setFillRule(src.fillRule);
Executed by:
  • tst_qquickshape
12
168-
169 if (listChanged
listChangedDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
|| (
(src.dirty & DirtyPen)Description
TRUEnever evaluated
FALSEnever evaluated
src.dirty & DirtyPen)
(src.dirty & DirtyPen)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-12
170 dst.pen = src.pen;-
171 dst.strokeWidth = src.strokeWidth;-
172 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
173-
174 if (listChanged
listChangedDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
|| (
(src.dirty & DirtyBrush)Description
TRUEnever evaluated
FALSEnever evaluated
src.dirty & DirtyBrush)
(src.dirty & DirtyBrush)Description
TRUEnever evaluated
FALSEnever evaluated
)
0-12
175 dst.brush = src.brush;
executed 12 times by 1 test: dst.brush = src.brush;
Executed by:
  • tst_qquickshape
12
176-
177 src.dirty = 0;-
178-
179 QRectF br = dst.path.boundingRect();-
180 const float sw = qMax(1.0f, dst.strokeWidth);-
181 br.adjust(-sw, -sw, sw, sw);-
182 m_node->m_boundingRect |= br;-
183 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
184-
185 m_node->markDirty(QSGNode::DirtyMaterial);-
186 m_accDirty = 0;-
187}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
188-
189QQuickShapeSoftwareRenderNode::QQuickShapeSoftwareRenderNode(QQuickShape *item)-
190 : m_item(item)-
191{-
192}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
193-
194QQuickShapeSoftwareRenderNode::~QQuickShapeSoftwareRenderNode()-
195{-
196 releaseResources();-
197}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
198-
199void QQuickShapeSoftwareRenderNode::releaseResources()-
200{-
201}-
202-
203void QQuickShapeSoftwareRenderNode::render(const RenderState *state)-
204{-
205 if (m_sp.isEmpty()
m_sp.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-8
206 return;
never executed: return;
0
207-
208 QSGRendererInterface *rif = m_item->window()->rendererInterface();-
209 QPainter *p = static_cast<QPainter *>(rif->getResource(m_item->window(), QSGRendererInterface::PainterResource));-
210 ((p) ? static_cast<void>(0) : qt_assert("p", __FILE__, 251));-
211-
212 const QRegion *clipRegion = state->clipRegion();-
213 if (clipRegion
clipRegionDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
&& !clipRegion->isEmpty()
!clipRegion->isEmpty()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
)
0-8
214 p->setClipRegion(*clipRegion, Qt::ReplaceClip);
executed 8 times by 1 test: p->setClipRegion(*clipRegion, Qt::ReplaceClip);
Executed by:
  • tst_qquickshape
8
215-
216 p->setTransform(matrix()->toTransform());-
217 p->setOpacity(inheritedOpacity());-
218-
219 for (const ShapePathRenderData &d : qAsConst(m_sp)) {-
220 p->setPen(d.strokeWidth >= 0.0f && d.pen.color() != Qt::transparent ? d.pen : Qt::NoPen);-
221 p->setBrush(d.brush.color() != Qt::transparent ? d.brush : Qt::NoBrush);-
222 p->drawPath(d.path);-
223 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
224}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
225-
226QSGRenderNode::StateFlags QQuickShapeSoftwareRenderNode::changedStates() const-
227{-
228 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
229}-
230-
231QSGRenderNode::RenderingFlags QQuickShapeSoftwareRenderNode::flags() const-
232{-
233 return
executed 16 times by 1 test: return BoundedRectRendering;
Executed by:
  • tst_qquickshape
BoundedRectRendering;
executed 16 times by 1 test: return BoundedRectRendering;
Executed by:
  • tst_qquickshape
16
234}-
235-
236QRectF QQuickShapeSoftwareRenderNode::rect() const-
237{-
238 return
executed 8 times by 1 test: return m_boundingRect;
Executed by:
  • tst_qquickshape
m_boundingRect;
executed 8 times by 1 test: return m_boundingRect;
Executed by:
  • tst_qquickshape
8
239}-
240-
241-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0