OpenCoverage

qsgsimpletexturenode.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4class QSGSimpleTextureNodePrivate : public QSGGeometryNodePrivate-
5{-
6public:-
7 QSGSimpleTextureNodePrivate()-
8 : texCoordMode(QSGSimpleTextureNode::NoTransform)-
9 , isAtlasTexture(false)-
10 , ownsTexture(false)-
11 {}
executed 18 times by 2 tests: end of block
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
18
12-
13 QRectF sourceRect;-
14 QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode;-
15 uint isAtlasTexture : 1;-
16 uint ownsTexture : 1;-
17};-
18-
19static void qsgsimpletexturenode_update(QSGGeometry *g,-
20 QSGTexture *texture,-
21 const QRectF &rect,-
22 QRectF sourceRect,-
23 QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode)-
24{-
25 if (!texture
!textureDescription
TRUEnever evaluated
FALSEevaluated 56 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
)
0-56
26 return;
never executed: return;
0
27-
28 if (!sourceRect.width()
!sourceRect.width()Description
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_nodestest
|| !sourceRect.height()
!sourceRect.height()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_nodestest
) {
0-52
29 QSize ts = texture->textureSize();-
30 sourceRect = QRectF(0, 0, ts.width(), ts.height());-
31 }
executed 52 times by 2 tests: end of block
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
52
32-
33-
34 if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorHorizontally)
texCoordMode.t...rHorizontally)Description
TRUEnever evaluated
FALSEevaluated 56 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
) {
0-56
35 float tmp = sourceRect.left();-
36 sourceRect.setLeft(sourceRect.right());-
37 sourceRect.setRight(tmp);-
38 }
never executed: end of block
0
39 if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorVertically)
texCoordMode.t...rorVertically)Description
TRUEnever evaluated
FALSEevaluated 56 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
) {
0-56
40 float tmp = sourceRect.top();-
41 sourceRect.setTop(sourceRect.bottom());-
42 sourceRect.setBottom(tmp);-
43 }
never executed: end of block
0
44-
45 QSGGeometry::updateTexturedRectGeometry(g, rect, texture->convertToNormalizedSourceRect(sourceRect));-
46}
executed 56 times by 2 tests: end of block
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
56
47QSGSimpleTextureNode::QSGSimpleTextureNode()-
48 : QSGGeometryNode(*new QSGSimpleTextureNodePrivate)-
49 , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)-
50{-
51 setGeometry(&m_geometry);-
52 setMaterial(&m_material);-
53 setOpaqueMaterial(&m_opaque_material);-
54 m_material.setMipmapFiltering(QSGTexture::None);-
55 m_opaque_material.setMipmapFiltering(QSGTexture::None);-
56-
57 qsgnode_set_description(this, QLatin1String("simpletexture"));-
58-
59}
executed 18 times by 2 tests: end of block
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
18
60-
61-
62-
63-
64QSGSimpleTextureNode::~QSGSimpleTextureNode()-
65{-
66 QSGSimpleTextureNodePrivate * const d = d_func();-
67 if (d->ownsTexture
d->ownsTextureDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_nodestest
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
)
4-14
68 delete m_material.texture();
executed 4 times by 1 test: delete m_material.texture();
Executed by:
  • tst_nodestest
4
69}
executed 18 times by 2 tests: end of block
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
18
70-
71-
72-
73-
74-
75-
76-
77void QSGSimpleTextureNode::setFiltering(QSGTexture::Filtering filtering)-
78{-
79 if (m_material.filtering() == filtering
m_material.fil...) == filteringDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickframebufferobject
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickframebufferobject
)
10
80 return;
executed 10 times by 1 test: return;
Executed by:
  • tst_qquickframebufferobject
10
81-
82 m_material.setFiltering(filtering);-
83 m_opaque_material.setFiltering(filtering);-
84 markDirty(DirtyMaterial);-
85}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickframebufferobject
10
86-
87-
88-
89-
90-
91QSGTexture::Filtering QSGSimpleTextureNode::filtering() const-
92{-
93 return
never executed: return m_material.filtering();
m_material.filtering();
never executed: return m_material.filtering();
0
94}-
95-
96-
97-
98-
99-
100void QSGSimpleTextureNode::setRect(const QRectF &r)-
101{-
102 if (m_rect == r
m_rect == rDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickframebufferobject
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
)
2-22
103 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickframebufferobject
2
104 m_rect = r;-
105 QSGSimpleTextureNodePrivate * const d = d_func();-
106 qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode);-
107 markDirty(DirtyGeometry);-
108}
executed 22 times by 2 tests: end of block
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
22
109QRectF QSGSimpleTextureNode::rect() const-
110{-
111 return
never executed: return m_rect;
m_rect;
never executed: return m_rect;
0
112}-
113-
114-
115-
116-
117-
118-
119void QSGSimpleTextureNode::setSourceRect(const QRectF &r)-
120{-
121 QSGSimpleTextureNodePrivate * const d = d_func();-
122 if (d->sourceRect == r
d->sourceRect == rDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_nodestest
)
0-4
123 return;
never executed: return;
0
124 d->sourceRect = r;-
125 qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode);-
126 markDirty(DirtyGeometry);-
127}
executed 4 times by 1 test: end of block
Executed by:
  • tst_nodestest
4
128QRectF QSGSimpleTextureNode::sourceRect() const-
129{-
130 const QSGSimpleTextureNodePrivate * const d = d_func();-
131 return
never executed: return d->sourceRect;
d->sourceRect;
never executed: return d->sourceRect;
0
132}-
133void QSGSimpleTextureNode::setTexture(QSGTexture *texture)-
134{-
135 ((texture) ? static_cast<void>(0) : qt_assert("texture", __FILE__, 237));-
136 QSGSimpleTextureNodePrivate * const d = d_func();-
137 if (d->ownsTexture
d->ownsTextureDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_nodestest
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
)
6-24
138 delete m_material.texture();
executed 6 times by 1 test: delete m_material.texture();
Executed by:
  • tst_nodestest
6
139 m_material.setTexture(texture);-
140 m_opaque_material.setTexture(texture);-
141 qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->sourceRect, d->texCoordMode);-
142-
143 DirtyState dirty = DirtyMaterial;-
144-
145-
146-
147 bool wasAtlas = d->isAtlasTexture;-
148 d->isAtlasTexture = texture->isAtlasTexture();-
149 if (wasAtlas
wasAtlasDescription
TRUEnever evaluated
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
|| d->isAtlasTexture
d->isAtlasTextureDescription
TRUEnever evaluated
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_nodestest
  • tst_qquickframebufferobject
)
0-30
150 dirty |= DirtyGeometry;
never executed: dirty |= DirtyGeometry;
0
151 markDirty(dirty);-
152}
executed 30 times by 2 tests: end of block
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
30
153-
154-
155-
156-
157-
158-
159QSGTexture *QSGSimpleTextureNode::texture() const-
160{-
161 return
executed 46 times by 2 tests: return m_material.texture();
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
m_material.texture();
executed 46 times by 2 tests: return m_material.texture();
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
46
162}-
163void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode)-
164{-
165 QSGSimpleTextureNodePrivate * const d = d_func();-
166 if (d->texCoordMode == mode
d->texCoordMode == modeDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickframebufferobject
FALSEnever evaluated
)
0-20
167 return;
executed 20 times by 1 test: return;
Executed by:
  • tst_qquickframebufferobject
20
168 d->texCoordMode = mode;-
169 qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode);-
170 markDirty(DirtyMaterial);-
171}
never executed: end of block
0
172-
173-
174-
175-
176-
177-
178QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const-
179{-
180 const QSGSimpleTextureNodePrivate * const d = d_func();-
181 return
never executed: return d->texCoordMode;
d->texCoordMode;
never executed: return d->texCoordMode;
0
182}-
183void QSGSimpleTextureNode::setOwnsTexture(bool owns)-
184{-
185 QSGSimpleTextureNodePrivate * const d = d_func();-
186 d->ownsTexture = owns;-
187}
executed 4 times by 1 test: end of block
Executed by:
  • tst_nodestest
4
188-
189-
190-
191-
192-
193-
194bool QSGSimpleTextureNode::ownsTexture() const-
195{-
196 const QSGSimpleTextureNodePrivate * const d = d_func();-
197 return
executed 6 times by 1 test: return d->ownsTexture;
Executed by:
  • tst_nodestest
d->ownsTexture;
executed 6 times by 1 test: return d->ownsTexture;
Executed by:
  • tst_nodestest
6
198}-
199-
200-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0