OpenCoverage

qquickshadereffectmesh.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickshadereffectmesh.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4static const char qt_position_attribute_name[] = "qt_Vertex";-
5static const char qt_texcoord_attribute_name[] = "qt_MultiTexCoord0";-
6-
7const char *qtPositionAttributeName()-
8{-
9 return
executed 238 times by 5 tests: return qt_position_attribute_name;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
qt_position_attribute_name;
executed 238 times by 5 tests: return qt_position_attribute_name;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
238
10}-
11-
12const char *qtTexCoordAttributeName()-
13{-
14 return
executed 246 times by 5 tests: return qt_texcoord_attribute_name;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
qt_texcoord_attribute_name;
executed 246 times by 5 tests: return qt_texcoord_attribute_name;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
246
15}-
16-
17QQuickShaderEffectMesh::QQuickShaderEffectMesh(QObject *parent)-
18 : QObject(parent)-
19{-
20}
executed 110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
110
21QQuickGridMesh::QQuickGridMesh(QObject *parent)-
22 : QQuickShaderEffectMesh(parent)-
23 , m_resolution(1, 1)-
24{-
25}
executed 108 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
108
26-
27bool QQuickGridMesh::validateAttributes(const QVector<QByteArray> &attributes, int *posIndex)-
28{-
29 const int attrCount = attributes.count();-
30 int positionIndex = attributes.indexOf(qtPositionAttributeName());-
31 int texCoordIndex = attributes.indexOf(qtTexCoordAttributeName());-
32-
33 switch (attrCount) {-
34 case
never executed: case 0:
0:
never executed: case 0:
0
35 m_log = QLatin1String("Error: No attributes specified.");-
36 return
never executed: return false;
false;
never executed: return false;
0
37 case
never executed: case 1:
1:
never executed: case 1:
0
38 if (positionIndex != 0
positionIndex != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
39 m_log = QLatin1String("Error: Missing \'") + QLatin1String(qtPositionAttributeName())-
40 + QLatin1String("\' attribute.\n");-
41 return
never executed: return false;
false;
never executed: return false;
0
42 }-
43 break;
never executed: break;
0
44 case
executed 62 times by 4 tests: case 2:
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
2:
executed 62 times by 4 tests: case 2:
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
62
45 if (positionIndex == -1
positionIndex == -1Description
TRUEnever evaluated
FALSEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
|| texCoordIndex == -1
texCoordIndex == -1Description
TRUEnever evaluated
FALSEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
) {
0-62
46 m_log.clear();-
47 if (positionIndex == -1
positionIndex == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
48 m_log = QLatin1String("Error: Missing \'") + QLatin1String(qtPositionAttributeName())-
49 + QLatin1String("\' attribute.\n");-
50 }
never executed: end of block
0
51 if (texCoordIndex == -1
texCoordIndex == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
52 m_log += QLatin1String("Error: Missing \'") + QLatin1String(qtTexCoordAttributeName())-
53 + QLatin1String("\' attribute.\n");-
54 }
never executed: end of block
0
55 return
never executed: return false;
false;
never executed: return false;
0
56 }-
57 break;
executed 62 times by 4 tests: break;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
62
58 default
never executed: default:
:
never executed: default:
0
59 m_log = QLatin1String("Error: Too many attributes specified.");-
60 return
never executed: return false;
false;
never executed: return false;
0
61 }-
62-
63 if (posIndex
posIndexDescription
TRUEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEnever evaluated
)
0-62
64 *
executed 62 times by 4 tests: *posIndex = positionIndex;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
posIndex = positionIndex;
executed 62 times by 4 tests: *posIndex = positionIndex;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
62
65-
66 return
executed 62 times by 4 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
true;
executed 62 times by 4 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
62
67}-
68-
69QSGGeometry *QQuickGridMesh::updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,-
70 const QRectF &srcRect, const QRectF &dstRect)-
71{-
72 int vmesh = m_resolution.height();-
73 int hmesh = m_resolution.width();-
74-
75 if (!geometry
!geometryDescription
TRUEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEnever evaluated
) {
0-62
76 ((attrCount == 1 || attrCount == 2) ? static_cast<void>(0) : qt_assert("attrCount == 1 || attrCount == 2", __FILE__, 135));-
77 geometry = new QSGGeometry(attrCount == 1-
78 ? QSGGeometry::defaultAttributes_Point2D()-
79 : QSGGeometry::defaultAttributes_TexturedPoint2D(),-
80 (vmesh + 1) * (hmesh + 1), vmesh * 2 * (hmesh + 2),-
81 QSGGeometry::UnsignedShortType);-
82-
83 }
executed 62 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
else {
62
84 geometry->allocate((vmesh + 1) * (hmesh + 1), vmesh * 2 * (hmesh + 2));-
85 }
never executed: end of block
0
86-
87 QSGGeometry::Point2D *vdata = static_cast<QSGGeometry::Point2D *>(geometry->vertexData());-
88-
89 for (int iy = 0; iy <= vmesh
iy <= vmeshDescription
TRUEevaluated 124 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
; ++iy) {
62-124
90 float fy = iy / float(vmesh);-
91 float y = float(dstRect.top()) + fy * float(dstRect.height());-
92 float ty = float(srcRect.top()) + fy * float(srcRect.height());-
93 for (int ix = 0; ix <= hmesh
ix <= hmeshDescription
TRUEevaluated 248 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 124 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
; ++ix) {
124-248
94 float fx = ix / float(hmesh);-
95 for (int ia = 0; ia < attrCount
ia < attrCountDescription
TRUEevaluated 496 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 248 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
; ++ia) {
248-496
96 if (ia == posIndex
ia == posIndexDescription
TRUEevaluated 248 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 248 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
) {
248
97 vdata->x = float(dstRect.left()) + fx * float(dstRect.width());-
98 vdata->y = y;-
99 ++vdata;-
100 }
executed 248 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
else {
248
101 vdata->x = float(srcRect.left()) + fx * float(srcRect.width());-
102 vdata->y = ty;-
103 ++vdata;-
104 }
executed 248 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
248
105 }-
106 }
executed 248 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
248
107 }
executed 124 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
124
108-
109 quint16 *indices = (quint16 *)geometry->indexDataAsUShort();-
110 int i = 0;-
111 for (int iy = 0; iy < vmesh
iy < vmeshDescription
TRUEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
; ++iy) {
62
112 *(indices++) = i + hmesh + 1;-
113 for (int ix = 0; ix <= hmesh
ix <= hmeshDescription
TRUEevaluated 124 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 62 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
; ++ix, ++i) {
62-124
114 *(indices++) = i + hmesh + 1;-
115 *(indices++) = i;-
116 }
executed 124 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
124
117 *(indices++) = i - 1;-
118 }
executed 62 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
62
119-
120 return
executed 62 times by 4 tests: return geometry;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
geometry;
executed 62 times by 4 tests: return geometry;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
62
121}-
122void QQuickGridMesh::setResolution(const QSize &res)-
123{-
124 if (res == m_resolution
res == m_resolutionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
125 return;
never executed: return;
0
126 if (res.width() < 1
res.width() < 1Description
TRUEnever evaluated
FALSEnever evaluated
|| res.height() < 1
res.height() < 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
127 return;
never executed: return;
0
128 }-
129 m_resolution = res;-
130 resolutionChanged();-
131 geometryChanged();-
132}
never executed: end of block
0
133-
134QSize QQuickGridMesh::resolution() const-
135{-
136 return
never executed: return m_resolution;
m_resolution;
never executed: return m_resolution;
0
137}-
138QQuickBorderImageMesh::QQuickBorderImageMesh(QObject *parent)-
139 : QQuickShaderEffectMesh(parent), m_border(new QQuickScaleGrid(this)),-
140 m_horizontalTileMode(QQuickBorderImageMesh::Stretch),-
141 m_verticalTileMode(QQuickBorderImageMesh::Stretch)-
142{-
143}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickborderimage
2
144-
145bool QQuickBorderImageMesh::validateAttributes(const QVector<QByteArray> &attributes, int *posIndex)-
146{-
147 (void)attributes;;-
148 (void)posIndex;;-
149 return
executed 2 times by 1 test: return true;
Executed by:
  • tst_qquickborderimage
true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_qquickborderimage
2
150}-
151-
152QSGGeometry *QQuickBorderImageMesh::updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,-
153 const QRectF &srcRect, const QRectF &rect)-
154{-
155 (void)attrCount;;-
156 (void)posIndex;;-
157-
158 QRectF innerSourceRect;-
159 QRectF targetRect;-
160 QRectF innerTargetRect;-
161 QRectF subSourceRect;-
162-
163 QQuickBorderImagePrivate::calculateRects(m_border, m_size, rect.size(), m_horizontalTileMode, m_verticalTileMode,-
164 1, &targetRect, &innerTargetRect, &innerSourceRect, &subSourceRect);-
165-
166 QRectF sourceRect = srcRect;-
167 QRectF modifiedInnerSourceRect(sourceRect.x() + innerSourceRect.x() * sourceRect.width(),-
168 sourceRect.y() + innerSourceRect.y() * sourceRect.height(),-
169 innerSourceRect.width() * sourceRect.width(),-
170 innerSourceRect.height() * sourceRect.height());-
171-
172 geometry = QSGBasicInternalImageNode::updateGeometry(targetRect, innerTargetRect, sourceRect,-
173 modifiedInnerSourceRect, subSourceRect, geometry);-
174-
175 return
executed 2 times by 1 test: return geometry;
Executed by:
  • tst_qquickborderimage
geometry;
executed 2 times by 1 test: return geometry;
Executed by:
  • tst_qquickborderimage
2
176}-
177QQuickScaleGrid *QQuickBorderImageMesh::border() const-
178{-
179 return
executed 2 times by 1 test: return m_border;
Executed by:
  • tst_qquickborderimage
m_border;
executed 2 times by 1 test: return m_border;
Executed by:
  • tst_qquickborderimage
2
180}-
181-
182-
183-
184-
185-
186-
187-
188QSize QQuickBorderImageMesh::size() const-
189{-
190 return
never executed: return m_size;
m_size;
never executed: return m_size;
0
191}-
192-
193void QQuickBorderImageMesh::setSize(const QSize &size)-
194{-
195 if (size == m_size
size == m_sizeDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickborderimage
)
0-4
196 return;
never executed: return;
0
197 m_size = size;-
198 sizeChanged();-
199 geometryChanged();-
200}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickborderimage
4
201QQuickBorderImageMesh::TileMode QQuickBorderImageMesh::horizontalTileMode() const-
202{-
203 return
never executed: return m_horizontalTileMode;
m_horizontalTileMode;
never executed: return m_horizontalTileMode;
0
204}-
205-
206void QQuickBorderImageMesh::setHorizontalTileMode(TileMode t)-
207{-
208 if (t == m_horizontalTileMode
t == m_horizontalTileModeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
209 return;
never executed: return;
0
210 m_horizontalTileMode = t;-
211 horizontalTileModeChanged();-
212 geometryChanged();-
213}
never executed: end of block
0
214-
215QQuickBorderImageMesh::TileMode QQuickBorderImageMesh::verticalTileMode() const-
216{-
217 return
never executed: return m_verticalTileMode;
m_verticalTileMode;
never executed: return m_verticalTileMode;
0
218}-
219-
220void QQuickBorderImageMesh::setVerticalTileMode(TileMode t)-
221{-
222 if (t == m_verticalTileMode
t == m_verticalTileModeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
223 return;
never executed: return;
0
224-
225 m_verticalTileMode = t;-
226 verticalTileModeChanged();-
227 geometryChanged();-
228}
never executed: end of block
0
229-
230-
231-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0