OpenCoverage

qsgbasicinternalimagenode.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgbasicinternalimagenode.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5namespace-
6{-
7 struct SmoothVertex-
8 {-
9 float x, y, u, v;-
10 float dx, dy, du, dv;-
11 };-
12-
13 const QSGGeometry::AttributeSet &smoothAttributeSet()-
14 {-
15 static QSGGeometry::Attribute data[] = {-
16 QSGGeometry::Attribute::createWithAttributeType(0, 2, QSGGeometry::FloatType, QSGGeometry::PositionAttribute),-
17 QSGGeometry::Attribute::createWithAttributeType(1, 2, QSGGeometry::FloatType, QSGGeometry::TexCoordAttribute),-
18 QSGGeometry::Attribute::createWithAttributeType(2, 2, QSGGeometry::FloatType, QSGGeometry::TexCoord1Attribute),-
19 QSGGeometry::Attribute::createWithAttributeType(3, 2, QSGGeometry::FloatType, QSGGeometry::TexCoord2Attribute)-
20 };-
21 static QSGGeometry::AttributeSet attrs = { 4, sizeof(SmoothVertex), data };-
22 return
never executed: return attrs;
attrs;
never executed: return attrs;
0
23 }-
24}-
25-
26QSGBasicInternalImageNode::QSGBasicInternalImageNode()-
27 : m_innerSourceRect(0, 0, 1, 1)-
28 , m_subSourceRect(0, 0, 1, 1)-
29 , m_antialiasing(false)-
30 , m_mirror(false)-
31 , m_dirtyGeometry(false)-
32 , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)-
33 , m_dynamicTexture(nullptr)-
34{-
35 setGeometry(&m_geometry);-
36-
37-
38 qsgnode_set_description(this, QLatin1String("internalimage"));-
39-
40}
executed 5189 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5189
41-
42void QSGBasicInternalImageNode::setTargetRect(const QRectF &rect)-
43{-
44 if (rect == m_targetRect
rect == m_targetRectDescription
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_qquickanimatedimage
  • tst_qquickitemlayer
FALSEevaluated 5207 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
)
98-5207
45 return;
executed 98 times by 2 tests: return;
Executed by:
  • tst_qquickanimatedimage
  • tst_qquickitemlayer
98
46 m_targetRect = rect;-
47 m_dirtyGeometry = true;-
48}
executed 5207 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5207
49-
50void QSGBasicInternalImageNode::setInnerTargetRect(const QRectF &rect)-
51{-
52 if (rect == m_innerTargetRect
rect == m_innerTargetRectDescription
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_qquickanimatedimage
  • tst_qquickitemlayer
FALSEevaluated 5207 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
)
98-5207
53 return;
executed 98 times by 2 tests: return;
Executed by:
  • tst_qquickanimatedimage
  • tst_qquickitemlayer
98
54 m_innerTargetRect = rect;-
55 m_dirtyGeometry = true;-
56}
executed 5207 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5207
57-
58void QSGBasicInternalImageNode::setInnerSourceRect(const QRectF &rect)-
59{-
60 if (rect == m_innerSourceRect
rect == m_innerSourceRectDescription
TRUEnever evaluated
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
)
0-70
61 return;
never executed: return;
0
62 m_innerSourceRect = rect;-
63 m_dirtyGeometry = true;-
64}
executed 70 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
70
65-
66void QSGBasicInternalImageNode::setSubSourceRect(const QRectF &rect)-
67{-
68 if (rect == m_subSourceRect
rect == m_subSourceRectDescription
TRUEevaluated 5129 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
)
26-5129
69 return;
executed 5129 times by 8 tests: return;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
5129
70 m_subSourceRect = rect;-
71 m_dirtyGeometry = true;-
72}
executed 26 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
26
73-
74void QSGBasicInternalImageNode::setTexture(QSGTexture *texture)-
75{-
76 ((texture) ? static_cast<void>(0) : qt_assert("texture", __FILE__, 118));-
77-
78 setMaterialTexture(texture);-
79 updateMaterialBlending();-
80-
81 markDirty(DirtyMaterial);-
82-
83-
84 m_dirtyGeometry = true;-
85}
executed 5245 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5245
86-
87void QSGBasicInternalImageNode::setAntialiasing(bool antialiasing)-
88{-
89 if (antialiasing == m_antialiasing
antialiasing == m_antialiasingDescription
TRUEevaluated 5155 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEnever evaluated
)
0-5155
90 return;
executed 5155 times by 8 tests: return;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
5155
91 m_antialiasing = antialiasing;-
92 if (m_antialiasing
m_antialiasingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
93 setGeometry(new QSGGeometry(smoothAttributeSet(), 0));-
94 setFlag(OwnsGeometry, true);-
95 }
never executed: end of block
else {
0
96 setGeometry(&m_geometry);-
97 setFlag(OwnsGeometry, false);-
98 }
never executed: end of block
0
99 updateMaterialAntialiasing();-
100 m_dirtyGeometry = true;-
101}
never executed: end of block
0
102-
103void QSGBasicInternalImageNode::setMirror(bool mirror)-
104{-
105 if (mirror == m_mirror
mirror == m_mirrorDescription
TRUEevaluated 5133 times by 8 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 22 times by 3 tests
Evaluated by:
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickimage
)
22-5133
106 return;
executed 5133 times by 8 tests: return;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
5133
107 m_mirror = mirror;-
108 m_dirtyGeometry = true;-
109}
executed 22 times by 3 tests: end of block
Executed by:
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickimage
22
110-
111-
112void QSGBasicInternalImageNode::update()-
113{-
114 if (m_dirtyGeometry
m_dirtyGeometryDescription
TRUEevaluated 5249 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
)
56-5249
115 updateGeometry();
executed 5249 times by 10 tests: updateGeometry();
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5249
116}
executed 5305 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5305
117-
118void QSGBasicInternalImageNode::preprocess()-
119{-
120 bool doDirty = false;-
121 QSGDynamicTexture *t = qobject_cast<QSGDynamicTexture *>(materialTexture());-
122 if (t
tDescription
TRUEevaluated 126 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEnever evaluated
) {
0-126
123 doDirty = t->updateTexture();-
124 if (doDirty
doDirtyDescription
TRUEevaluated 31 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 95 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
) {
31-95
125-
126-
127 if (t != m_dynamicTexture
t != m_dynamicTextureDescription
TRUEevaluated 31 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEnever evaluated
0-31
128 || t->textureSize() != m_dynamicTextureSize
t->textureSize...micTextureSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
129 || t->normalizedTextureSubRect() != m_dynamicTextureSubRect
t->normalizedT...TextureSubRectDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
130 updateGeometry();-
131 m_dynamicTextureSize = t->textureSize();-
132 m_dynamicTextureSubRect = t->normalizedTextureSubRect();-
133 }
executed 31 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
31
134 }
executed 31 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
31
135 }
executed 126 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
126
136 m_dynamicTexture = t;-
137-
138 if (updateMaterialBlending()
updateMaterialBlending()Description
TRUEnever evaluated
FALSEevaluated 126 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
)
0-126
139 doDirty = true;
never executed: doDirty = true;
0
140-
141 if (doDirty
doDirtyDescription
TRUEevaluated 31 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 95 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
)
31-95
142 markDirty(DirtyMaterial);
executed 31 times by 2 tests: markDirty(DirtyMaterial);
Executed by:
  • tst_examples
  • tst_qquickitemlayer
31
143}
executed 126 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
126
144-
145namespace {-
146 struct X { float x, tx; };-
147 struct Y { float y, ty; };-
148}-
149-
150static inline void appendQuad(quint16 **indices, quint16 topLeft, quint16 topRight,-
151 quint16 bottomLeft, quint16 bottomRight)-
152{-
153 *(*indices)++ = topLeft;-
154 *(*indices)++ = bottomLeft;-
155 *(*indices)++ = bottomRight;-
156 *(*indices)++ = bottomRight;-
157 *(*indices)++ = topRight;-
158 *(*indices)++ = topLeft;-
159}
executed 636 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
636
160-
161QSGGeometry *QSGBasicInternalImageNode::updateGeometry(const QRectF &targetRect,-
162 const QRectF &innerTargetRect,-
163 const QRectF &sourceRect,-
164 const QRectF &innerSourceRect,-
165 const QRectF &subSourceRect,-
166 QSGGeometry *geometry,-
167 bool mirror,-
168 bool antialiasing)-
169{-
170 int floorLeft = qFloor(subSourceRect.left());-
171 int ceilRight = qCeil(subSourceRect.right());-
172 int floorTop = qFloor(subSourceRect.top());-
173 int ceilBottom = qCeil(subSourceRect.bottom());-
174 int hTiles = ceilRight - floorLeft;-
175 int vTiles = ceilBottom - floorTop;-
176-
177 int hCells = hTiles;-
178 int vCells = vTiles;-
179 if (innerTargetRect.width() == 0
innerTargetRect.width() == 0Description
TRUEnever evaluated
FALSEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
)
0-72
180 hCells = 0;
never executed: hCells = 0;
0
181 if (innerTargetRect.left() != targetRect.left()
innerTargetRec...getRect.left()Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
)
2-70
182 ++
executed 70 times by 2 tests: ++hCells;
Executed by:
  • tst_examples
  • tst_qquickborderimage
hCells;
executed 70 times by 2 tests: ++hCells;
Executed by:
  • tst_examples
  • tst_qquickborderimage
70
183 if (innerTargetRect.right() != targetRect.right()
innerTargetRec...etRect.right()Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
)
2-70
184 ++
executed 70 times by 2 tests: ++hCells;
Executed by:
  • tst_examples
  • tst_qquickborderimage
hCells;
executed 70 times by 2 tests: ++hCells;
Executed by:
  • tst_examples
  • tst_qquickborderimage
70
185 if (innerTargetRect.height() == 0
innerTargetRect.height() == 0Description
TRUEnever evaluated
FALSEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
)
0-72
186 vCells = 0;
never executed: vCells = 0;
0
187 if (innerTargetRect.top() != targetRect.top()
innerTargetRec...rgetRect.top()Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEnever evaluated
)
0-72
188 ++
executed 72 times by 2 tests: ++vCells;
Executed by:
  • tst_examples
  • tst_qquickborderimage
vCells;
executed 72 times by 2 tests: ++vCells;
Executed by:
  • tst_examples
  • tst_qquickborderimage
72
189 if (innerTargetRect.bottom() != targetRect.bottom()
innerTargetRec...tRect.bottom()Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEnever evaluated
)
0-72
190 ++
executed 72 times by 2 tests: ++vCells;
Executed by:
  • tst_examples
  • tst_qquickborderimage
vCells;
executed 72 times by 2 tests: ++vCells;
Executed by:
  • tst_examples
  • tst_qquickborderimage
72
191 QVarLengthArray<X, 32> xData(2 * hCells);-
192 QVarLengthArray<Y, 32> yData(2 * vCells);-
193 X *xs = xData.data();-
194 Y *ys = yData.data();-
195-
196 if (innerTargetRect.left() != targetRect.left()
innerTargetRec...getRect.left()Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
) {
2-70
197 xs[0].x = targetRect.left();-
198 xs[0].tx = sourceRect.left();-
199 xs[1].x = innerTargetRect.left();-
200 xs[1].tx = innerSourceRect.left();-
201 xs += 2;-
202 }
executed 70 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
70
203 if (innerTargetRect.width() != 0
innerTargetRect.width() != 0Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEnever evaluated
) {
0-72
204 xs[0].x = innerTargetRect.left();-
205 xs[0].tx = innerSourceRect.x() + (subSourceRect.left() - floorLeft) * innerSourceRect.width();-
206 ++xs;-
207 float b = innerTargetRect.width() / subSourceRect.width();-
208 float a = innerTargetRect.x() - subSourceRect.x() * b;-
209 for (int i = floorLeft + 1; i <= ceilRight - 1
i <= ceilRight - 1Description
TRUEnever evaluated
FALSEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
; ++i) {
0-72
210 xs[0].x = xs[1].x = a + b * i;-
211 xs[0].tx = innerSourceRect.right();-
212 xs[1].tx = innerSourceRect.left();-
213 xs += 2;-
214 }
never executed: end of block
0
215 xs[0].x = innerTargetRect.right();-
216 xs[0].tx = innerSourceRect.x() + (subSourceRect.right() - ceilRight + 1) * innerSourceRect.width();-
217 ++xs;-
218 }
executed 72 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
72
219 if (innerTargetRect.right() != targetRect.right()
innerTargetRec...etRect.right()Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
) {
2-70
220 xs[0].x = innerTargetRect.right();-
221 xs[0].tx = innerSourceRect.right();-
222 xs[1].x = targetRect.right();-
223 xs[1].tx = sourceRect.right();-
224 xs += 2;-
225 }
executed 70 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
70
226 ((xs == xData.data() + xData.size()) ? static_cast<void>(0) : qt_assert("xs == xData.data() + xData.size()", __FILE__, 268));-
227 if (mirror
mirrorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
) {
2-70
228 float leftPlusRight = targetRect.left() + targetRect.right();-
229 int count = xData.size();-
230 xs = xData.data();-
231 for (int i = 0; i < count >> 1
i < count >> 1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickborderimage
; ++i)
2-6
232 qSwap(xs[i], xs[count - 1 - i]);
executed 6 times by 1 test: qSwap(xs[i], xs[count - 1 - i]);
Executed by:
  • tst_qquickborderimage
6
233 for (int i = 0; i < count
i < countDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickborderimage
; ++i)
2-12
234 xs[i].x = leftPlusRight - xs[i].x;
executed 12 times by 1 test: xs[i].x = leftPlusRight - xs[i].x;
Executed by:
  • tst_qquickborderimage
12
235 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickborderimage
2
236-
237 if (innerTargetRect.top() != targetRect.top()
innerTargetRec...rgetRect.top()Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEnever evaluated
) {
0-72
238 ys[0].y = targetRect.top();-
239 ys[0].ty = sourceRect.top();-
240 ys[1].y = innerTargetRect.top();-
241 ys[1].ty = innerSourceRect.top();-
242 ys += 2;-
243 }
executed 72 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
72
244 if (innerTargetRect.height() != 0
innerTargetRect.height() != 0Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEnever evaluated
) {
0-72
245 ys[0].y = innerTargetRect.top();-
246 ys[0].ty = innerSourceRect.y() + (subSourceRect.top() - floorTop) * innerSourceRect.height();-
247 ++ys;-
248 float b = innerTargetRect.height() / subSourceRect.height();-
249 float a = innerTargetRect.y() - subSourceRect.y() * b;-
250 for (int i = floorTop + 1; i <= ceilBottom - 1
i <= ceilBottom - 1Description
TRUEnever evaluated
FALSEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
; ++i) {
0-72
251 ys[0].y = ys[1].y = a + b * i;-
252 ys[0].ty = innerSourceRect.bottom();-
253 ys[1].ty = innerSourceRect.top();-
254 ys += 2;-
255 }
never executed: end of block
0
256 ys[0].y = innerTargetRect.bottom();-
257 ys[0].ty = innerSourceRect.y() + (subSourceRect.bottom() - ceilBottom + 1) * innerSourceRect.height();-
258 ++ys;-
259 }
executed 72 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
72
260 if (innerTargetRect.bottom() != targetRect.bottom()
innerTargetRec...tRect.bottom()Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEnever evaluated
) {
0-72
261 ys[0].y = innerTargetRect.bottom();-
262 ys[0].ty = innerSourceRect.bottom();-
263 ys[1].y = targetRect.bottom();-
264 ys[1].ty = sourceRect.bottom();-
265 ys += 2;-
266 }
executed 72 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
72
267 ((ys == yData.data() + yData.size()) ? static_cast<void>(0) : qt_assert("ys == yData.data() + yData.size()", __FILE__, 309));-
268-
269 if (antialiasing
antialiasingDescription
TRUEnever evaluated
FALSEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
) {
0-72
270 QSGGeometry *g = geometry;-
271 ((g) ? static_cast<void>(0) : qt_assert("g", __FILE__, 313));-
272-
273 g->allocate(hCells * vCells * 4 + (hCells + vCells - 1) * 4,-
274 hCells * vCells * 6 + (hCells + vCells) * 12);-
275 g->setDrawingMode(QSGGeometry::DrawTriangles);-
276 SmoothVertex *vertices = reinterpret_cast<SmoothVertex *>(g->vertexData());-
277 memset(vertices, 0, g->vertexCount() * g->sizeOfVertex());-
278 quint16 *indices = g->indexDataAsUShort();-
279-
280-
281-
282-
283 float leftDx = xData.at(1).x - xData.at(0).x;-
284 float rightDx = xData.at(xData.size() - 1).x - xData.at(xData.size() - 2).x;-
285 float topDy = yData.at(1).y - yData.at(0).y;-
286 float bottomDy = yData.at(yData.size() - 1).y - yData.at(yData.size() - 2).y;-
287-
288 float leftDu = xData.at(1).tx - xData.at(0).tx;-
289 float rightDu = xData.at(xData.size() - 1).tx - xData.at(xData.size() - 2).tx;-
290 float topDv = yData.at(1).ty - yData.at(0).ty;-
291 float bottomDv = yData.at(yData.size() - 1).ty - yData.at(yData.size() - 2).ty;-
292-
293 if (hCells == 1
hCells == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
294 leftDx = rightDx *= 0.5f;-
295 leftDu = rightDu *= 0.5f;-
296 }
never executed: end of block
0
297 if (vCells == 1
vCells == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
298 topDy = bottomDy *= 0.5f;-
299 topDv = bottomDv *= 0.5f;-
300 }
never executed: end of block
0
301-
302-
303 float delta = float(qAbs(targetRect.width()) < qAbs(targetRect.height())-
304 ? targetRect.width() : targetRect.height()) * 0.5f;-
305-
306 quint16 index = 0;-
307 ys = yData.data();-
308 for (int j = 0; j < vCells
j < vCellsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j, ys += 2) {
0
309 xs = xData.data();-
310 bool isTop = j == 0;-
311 bool isBottom = j == vCells - 1;-
312 for (int i = 0; i < hCells
i < hCellsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i, xs += 2) {
0
313 bool isLeft = i == 0;-
314 bool isRight = i == hCells - 1;-
315-
316 SmoothVertex *v = vertices + index;-
317-
318 quint16 topLeft = index;-
319 for (int k = (isTop || isLeft ? 2 : 1); k--
k--Description
TRUEnever evaluated
FALSEnever evaluated
; ++v, ++index) {
0
320 v->x = xs[0].x;-
321 v->u = xs[0].tx;-
322 v->y = ys[0].y;-
323 v->v = ys[0].ty;-
324 }
never executed: end of block
0
325-
326 quint16 topRight = index;-
327 for (int k = (isTop || isRight ? 2 : 1); k--
k--Description
TRUEnever evaluated
FALSEnever evaluated
; ++v, ++index) {
0
328 v->x = xs[1].x;-
329 v->u = xs[1].tx;-
330 v->y = ys[0].y;-
331 v->v = ys[0].ty;-
332 }
never executed: end of block
0
333-
334 quint16 bottomLeft = index;-
335 for (int k = (isBottom || isLeft ? 2 : 1); k--
k--Description
TRUEnever evaluated
FALSEnever evaluated
; ++v, ++index) {
0
336 v->x = xs[0].x;-
337 v->u = xs[0].tx;-
338 v->y = ys[1].y;-
339 v->v = ys[1].ty;-
340 }
never executed: end of block
0
341-
342 quint16 bottomRight = index;-
343 for (int k = (isBottom || isRight ? 2 : 1); k--
k--Description
TRUEnever evaluated
FALSEnever evaluated
; ++v, ++index) {
0
344 v->x = xs[1].x;-
345 v->u = xs[1].tx;-
346 v->y = ys[1].y;-
347 v->v = ys[1].ty;-
348 }
never executed: end of block
0
349-
350 appendQuad(&indices, topLeft, topRight, bottomLeft, bottomRight);-
351-
352 if (isTop
isTopDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
353 vertices[topLeft].dy = vertices[topRight].dy = topDy;-
354 vertices[topLeft].dv = vertices[topRight].dv = topDv;-
355 vertices[topLeft + 1].dy = vertices[topRight + 1].dy = -delta;-
356 appendQuad(&indices, topLeft + 1, topRight + 1, topLeft, topRight);-
357 }
never executed: end of block
0
358-
359 if (isBottom
isBottomDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
360 vertices[bottomLeft].dy = vertices[bottomRight].dy = -bottomDy;-
361 vertices[bottomLeft].dv = vertices[bottomRight].dv = -bottomDv;-
362 vertices[bottomLeft + 1].dy = vertices[bottomRight + 1].dy = delta;-
363 appendQuad(&indices, bottomLeft, bottomRight, bottomLeft + 1, bottomRight + 1);-
364 }
never executed: end of block
0
365-
366 if (isLeft
isLeftDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
367 vertices[topLeft].dx = vertices[bottomLeft].dx = leftDx;-
368 vertices[topLeft].du = vertices[bottomLeft].du = leftDu;-
369 vertices[topLeft + 1].dx = vertices[bottomLeft + 1].dx = -delta;-
370 appendQuad(&indices, topLeft + 1, topLeft, bottomLeft + 1, bottomLeft);-
371 }
never executed: end of block
0
372-
373 if (isRight
isRightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
374 vertices[topRight].dx = vertices[bottomRight].dx = -rightDx;-
375 vertices[topRight].du = vertices[bottomRight].du = -rightDu;-
376 vertices[topRight + 1].dx = vertices[bottomRight + 1].dx = delta;-
377 appendQuad(&indices, topRight, topRight + 1, bottomRight, bottomRight + 1);-
378 }
never executed: end of block
0
379 }
never executed: end of block
0
380 }
never executed: end of block
0
381-
382 ((index == g->vertexCount()) ? static_cast<void>(0) : qt_assert("index == g->vertexCount()", __FILE__, 424));-
383 ((indices - g->indexCount() == g->indexData()) ? static_cast<void>(0) : qt_assert("indices - g->indexCount() == g->indexData()", __FILE__, 425));-
384 }
never executed: end of block
else {
0
385 if (!geometry
!geometryDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
) {
2-70
386 geometry = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(),-
387 hCells * vCells * 4, hCells * vCells * 6,-
388 QSGGeometry::UnsignedShortType);-
389 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickborderimage
else {
2
390 geometry->allocate(hCells * vCells * 4, hCells * vCells * 6);-
391 }
executed 70 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
70
392 geometry->setDrawingMode(QSGGeometry::DrawTriangles);-
393 QSGGeometry::TexturedPoint2D *vertices = geometry->vertexDataAsTexturedPoint2D();-
394 ys = yData.data();-
395 for (int j = 0; j < vCells
j < vCellsDescription
TRUEevaluated 216 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
; ++j, ys += 2) {
72-216
396 xs = xData.data();-
397 for (int i = 0; i < hCells
i < hCellsDescription
TRUEevaluated 636 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 216 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
; ++i, xs += 2) {
216-636
398 vertices[0].x = vertices[2].x = xs[0].x;-
399 vertices[0].tx = vertices[2].tx = xs[0].tx;-
400 vertices[1].x = vertices[3].x = xs[1].x;-
401 vertices[1].tx = vertices[3].tx = xs[1].tx;-
402-
403 vertices[0].y = vertices[1].y = ys[0].y;-
404 vertices[0].ty = vertices[1].ty = ys[0].ty;-
405 vertices[2].y = vertices[3].y = ys[1].y;-
406 vertices[2].ty = vertices[3].ty = ys[1].ty;-
407-
408 vertices += 4;-
409 }
executed 636 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
636
410 }
executed 216 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
216
411-
412 quint16 *indices = geometry->indexDataAsUShort();-
413 for (int i = 0; i < 4 * vCells * hCells
i < 4 * vCells * hCellsDescription
TRUEevaluated 636 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
; i += 4)
72-636
414 appendQuad(&indices, i, i + 1, i + 2, i + 3);
executed 636 times by 2 tests: appendQuad(&indices, i, i + 1, i + 2, i + 3);
Executed by:
  • tst_examples
  • tst_qquickborderimage
636
415 }
executed 72 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
72
416 return
executed 72 times by 2 tests: return geometry;
Executed by:
  • tst_examples
  • tst_qquickborderimage
geometry;
executed 72 times by 2 tests: return geometry;
Executed by:
  • tst_examples
  • tst_qquickborderimage
72
417}-
418-
419void QSGBasicInternalImageNode::updateGeometry()-
420{-
421 ((!m_targetRect.isEmpty()) ? static_cast<void>(0) : qt_assert("!m_targetRect.isEmpty()", __FILE__, 463));-
422 const QSGTexture *t = materialTexture();-
423 if (!t
!tDescription
TRUEnever evaluated
FALSEevaluated 5280 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
) {
0-5280
424 QSGGeometry *g = geometry();-
425 g->allocate(4);-
426 g->setDrawingMode(QSGGeometry::DrawTriangleStrip);-
427 memset(g->vertexData(), 0, g->sizeOfVertex() * 4);-
428 }
never executed: end of block
else {
0
429 QRectF sourceRect = t->normalizedTextureSubRect();-
430-
431 QRectF innerSourceRect(sourceRect.x() + m_innerSourceRect.x() * sourceRect.width(),-
432 sourceRect.y() + m_innerSourceRect.y() * sourceRect.height(),-
433 m_innerSourceRect.width() * sourceRect.width(),-
434 m_innerSourceRect.height() * sourceRect.height());-
435-
436 bool hasMargins = m_targetRect != m_innerTargetRect;-
437-
438 int floorLeft = qFloor(m_subSourceRect.left());-
439 int ceilRight = qCeil(m_subSourceRect.right());-
440 int floorTop = qFloor(m_subSourceRect.top());-
441 int ceilBottom = qCeil(m_subSourceRect.bottom());-
442 int hTiles = ceilRight - floorLeft;-
443 int vTiles = ceilBottom - floorTop;-
444-
445 bool hasTiles = hTiles != 1
hTiles != 1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickimage
FALSEevaluated 5274 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
|| vTiles != 1
vTiles != 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickimage
FALSEevaluated 5270 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
;
4-5274
446 bool fullTexture = innerSourceRect == QRectF(0, 0, 1, 1);-
447-
448-
449-
450-
451-
452-
453 if (!hasMargins
!hasMarginsDescription
TRUEevaluated 5210 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
&& (!hasTiles
!hasTilesDescription
TRUEevaluated 5200 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickimage
|| (fullTexture
fullTextureDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickimage
FALSEnever evaluated
&& supportsWrap(t->textureSize())
supportsWrap(t->textureSize())Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickimage
FALSEnever evaluated
))) {
0-5210
454 QRectF sr;-
455 if (!fullTexture
!fullTextureDescription
TRUEevaluated 4947 times by 9 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 263 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquicktext
  • tst_scenegraph
) {
263-4947
456 sr = QRectF(innerSourceRect.x() + (m_subSourceRect.left() - floorLeft) * innerSourceRect.width(),-
457 innerSourceRect.y() + (m_subSourceRect.top() - floorTop) * innerSourceRect.height(),-
458 m_subSourceRect.width() * innerSourceRect.width(),-
459 m_subSourceRect.height() * innerSourceRect.height());-
460 }
executed 4947 times by 9 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
else {
4947
461 sr = QRectF(m_subSourceRect.left() - floorLeft, m_subSourceRect.top() - floorTop,-
462 m_subSourceRect.width(), m_subSourceRect.height());-
463 }
executed 263 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquicktext
  • tst_scenegraph
263
464 if (m_mirror
m_mirrorDescription
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_qquickanimatedimage
  • tst_qquickimage
FALSEevaluated 5188 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
) {
22-5188
465 qreal oldLeft = sr.left();-
466 sr.setLeft(sr.right());-
467 sr.setRight(oldLeft);-
468 }
executed 22 times by 2 tests: end of block
Executed by:
  • tst_qquickanimatedimage
  • tst_qquickimage
22
469-
470 if (m_antialiasing
m_antialiasingDescription
TRUEnever evaluated
FALSEevaluated 5210 times by 10 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
) {
0-5210
471 QSGGeometry *g = geometry();-
472 ((g != &m_geometry) ? static_cast<void>(0) : qt_assert("g != &m_geometry", __FILE__, 514));-
473 g->allocate(8, 14);-
474 g->setDrawingMode(QSGGeometry::DrawTriangleStrip);-
475 SmoothVertex *vertices = reinterpret_cast<SmoothVertex *>(g->vertexData());-
476 float delta = float(qAbs(m_targetRect.width()) < qAbs(m_targetRect.height())-
477 ? m_targetRect.width() : m_targetRect.height()) * 0.5f;-
478 float sx = float(sr.width() / m_targetRect.width());-
479 float sy = float(sr.height() / m_targetRect.height());-
480 for (int d = -1; d <= 1
d <= 1Description
TRUEnever evaluated
FALSEnever evaluated
; d += 2) {
0
481 for (int j = 0; j < 2
j < 2Description
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
482 for (int i = 0; i < 2
i < 2Description
TRUEnever evaluated
FALSEnever evaluated
; ++i, ++vertices) {
0
483 vertices->x = m_targetRect.x() + i * m_targetRect.width();-
484 vertices->y = m_targetRect.y() + j * m_targetRect.height();-
485 vertices->u = sr.x() + i * sr.width();-
486 vertices->v = sr.y() + j * sr.height();-
487 vertices->dx = (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
? delta : -delta) * d;
0
488 vertices->dy = (j == 0
j == 0Description
TRUEnever evaluated
FALSEnever evaluated
? delta : -delta) * d;
0
489 vertices->du = (d < 0
d < 0Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : vertices->dx * sx);
0
490 vertices->dv = (d < 0
d < 0Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : vertices->dy * sy);
0
491 }
never executed: end of block
0
492 }
never executed: end of block
0
493 }
never executed: end of block
0
494 ((vertices - g->vertexCount() == g->vertexData()) ? static_cast<void>(0) : qt_assert("vertices - g->vertexCount() == g->vertexData()", __FILE__, 536));-
495 static const quint16 indices[] = {-
496 0, 4, 1, 5, 3, 7, 2, 6, 0, 4,-
497 4, 6, 5, 7-
498 };-
499 ((g->sizeOfIndex() * g->indexCount() == sizeof(indices)) ? static_cast<void>(0) : qt_assert("g->sizeOfIndex() * g->indexCount() == sizeof(indices)", __FILE__, 541));-
500 memcpy(g->indexDataAsUShort(), indices, sizeof(indices));-
501 }
never executed: end of block
else {
0
502 m_geometry.allocate(4);-
503 m_geometry.setDrawingMode(QSGGeometry::DrawTriangleStrip);-
504 QSGGeometry::updateTexturedRectGeometry(&m_geometry, m_targetRect, sr);-
505 }
executed 5210 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5210
506 } else {-
507 QSGGeometry *g = m_antialiasing
m_antialiasingDescription
TRUEnever evaluated
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
? geometry() : &m_geometry;
0-70
508 updateGeometry(m_targetRect, m_innerTargetRect,-
509 sourceRect, innerSourceRect, m_subSourceRect,-
510 g, m_mirror, m_antialiasing);-
511 }
executed 70 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
70
512 }-
513 markDirty(DirtyGeometry);-
514 m_dirtyGeometry = false;-
515}
executed 5280 times by 10 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5280
516-
517-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0