OpenCoverage

qsgdefaultinternalimagenode.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4class SmoothTextureMaterialShader : public QSGTextureMaterialShader-
5{-
6public:-
7 SmoothTextureMaterialShader();-
8-
9 void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;-
10 char const *const *attributeNames() const override;-
11-
12protected:-
13 void initialize() override;-
14-
15 int m_pixelSizeLoc;-
16};-
17-
18-
19QSGSmoothTextureMaterial::QSGSmoothTextureMaterial()-
20{-
21 setFlag(RequiresFullMatrixExceptTranslate, true);-
22 setFlag(Blending, true);-
23}
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
24-
25void QSGSmoothTextureMaterial::setTexture(QSGTexture *texture)-
26{-
27 m_texture = texture;-
28}
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
29-
30QSGMaterialType *QSGSmoothTextureMaterial::type() const-
31{-
32 static QSGMaterialType type;-
33 return
never executed: return &type;
&type;
never executed: return &type;
0
34}-
35-
36QSGMaterialShader *QSGSmoothTextureMaterial::createShader() const-
37{-
38 return
never executed: return new SmoothTextureMaterialShader;
new SmoothTextureMaterialShader;
never executed: return new SmoothTextureMaterialShader;
0
39}-
40-
41SmoothTextureMaterialShader::SmoothTextureMaterialShader()-
42{-
43 setShaderSourceFile(QOpenGLShader::Vertex, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/smoothtexture.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/smoothtexture.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
0
44 setShaderSourceFile(QOpenGLShader::Fragment, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/smoothtexture.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/smoothtexture.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
0
45}
never executed: end of block
0
46-
47void SmoothTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)-
48{-
49 if (oldEffect == nullptr
oldEffect == nullptrDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
50-
51 QRect r = state.viewportRect();-
52 program()->setUniformValue(m_pixelSizeLoc, 2.0f / r.width(), 2.0f / r.height());-
53 }
never executed: end of block
0
54 QSGTextureMaterialShader::updateState(state, newEffect, oldEffect);-
55}
never executed: end of block
0
56-
57char const *const *SmoothTextureMaterialShader::attributeNames() const-
58{-
59 static char const *const attributes[] = {-
60 "vertex",-
61 "multiTexCoord",-
62 "vertexOffset",-
63 "texCoordOffset",-
64 nullptr-
65 };-
66 return
never executed: return attributes;
attributes;
never executed: return attributes;
0
67}-
68-
69void SmoothTextureMaterialShader::initialize()-
70{-
71 m_pixelSizeLoc = program()->uniformLocation("pixelSize");-
72 QSGTextureMaterialShader::initialize();-
73}
never executed: end of block
0
74-
75QSGDefaultInternalImageNode::QSGDefaultInternalImageNode()-
76{-
77 setMaterial(&m_materialO);-
78 setOpaqueMaterial(&m_material);-
79}
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
80-
81void QSGDefaultInternalImageNode::setFiltering(QSGTexture::Filtering filtering)-
82{-
83 if (m_material.filtering() == filtering
m_material.fil...) == filteringDescription
TRUEevaluated 184 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_scenegraph
FALSEevaluated 5121 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
)
184-5121
84 return;
executed 184 times by 5 tests: return;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_scenegraph
184
85-
86 m_material.setFiltering(filtering);-
87 m_materialO.setFiltering(filtering);-
88 m_smoothMaterial.setFiltering(filtering);-
89 markDirty(DirtyMaterial);-
90}
executed 5121 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
5121
91-
92void QSGDefaultInternalImageNode::setMipmapFiltering(QSGTexture::Filtering filtering)-
93{-
94 if (m_material.mipmapFiltering() == filtering
m_material.mip...) == filteringDescription
TRUEevaluated 5269 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 6 times by 2 tests
Evaluated by:
  • tst_qquickitemlayer
  • tst_scenegraph
)
6-5269
95 return;
executed 5269 times by 9 tests: return;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
5269
96-
97 m_material.setMipmapFiltering(filtering);-
98 m_materialO.setMipmapFiltering(filtering);-
99 m_smoothMaterial.setMipmapFiltering(filtering);-
100 markDirty(DirtyMaterial);-
101}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_qquickitemlayer
  • tst_scenegraph
6
102-
103void QSGDefaultInternalImageNode::setVerticalWrapMode(QSGTexture::WrapMode wrapMode)-
104{-
105 if (m_material.verticalWrapMode() == wrapMode
m_material.ver...() == wrapModeDescription
TRUEevaluated 5269 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 6 times by 1 test
Evaluated by:
  • tst_qquickimage
)
6-5269
106 return;
executed 5269 times by 9 tests: return;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
5269
107-
108 m_material.setVerticalWrapMode(wrapMode);-
109 m_materialO.setVerticalWrapMode(wrapMode);-
110 m_smoothMaterial.setVerticalWrapMode(wrapMode);-
111 markDirty(DirtyMaterial);-
112}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickimage
6
113-
114void QSGDefaultInternalImageNode::setHorizontalWrapMode(QSGTexture::WrapMode wrapMode)-
115{-
116 if (m_material.horizontalWrapMode() == wrapMode
m_material.hor...() == wrapModeDescription
TRUEevaluated 5267 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 8 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
)
8-5267
117 return;
executed 5267 times by 9 tests: return;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_scenegraph
5267
118-
119 m_material.setHorizontalWrapMode(wrapMode);-
120 m_materialO.setHorizontalWrapMode(wrapMode);-
121 m_smoothMaterial.setHorizontalWrapMode(wrapMode);-
122 markDirty(DirtyMaterial);-
123}
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
8
124-
125void QSGDefaultInternalImageNode::updateMaterialAntialiasing()-
126{-
127 if (m_antialiasing
m_antialiasingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
128 setMaterial(&m_smoothMaterial);-
129 setOpaqueMaterial(nullptr);-
130 }
never executed: end of block
else {
0
131 setMaterial(&m_materialO);-
132 setOpaqueMaterial(&m_material);-
133 }
never executed: end of block
0
134}-
135-
136void QSGDefaultInternalImageNode::setMaterialTexture(QSGTexture *texture)-
137{-
138 m_material.setTexture(texture);-
139 m_materialO.setTexture(texture);-
140 m_smoothMaterial.setTexture(texture);-
141}
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
142-
143QSGTexture *QSGDefaultInternalImageNode::materialTexture() const-
144{-
145 return
executed 16148 times by 10 tests: return m_material.texture();
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
m_material.texture();
executed 16148 times by 10 tests: return m_material.texture();
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
16148
146}-
147-
148bool QSGDefaultInternalImageNode::updateMaterialBlending()-
149{-
150 const bool alpha = m_material.flags() & QSGMaterial::Blending;-
151 if (materialTexture()
materialTexture()Description
TRUEevaluated 5371 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
FALSEnever evaluated
&& alpha != materialTexture()->hasAlphaChannel()
alpha != mater...AlphaChannel()Description
TRUEnever evaluated
FALSEevaluated 5371 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-5371
152 m_material.setFlag(QSGMaterial::Blending, !alpha);-
153 return
never executed: return true;
true;
never executed: return true;
0
154 }-
155 return
executed 5371 times by 10 tests: return false;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
false;
executed 5371 times by 10 tests: return false;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
5371
156}-
157-
158inline static bool isPowerOfTwo(int x)-
159{-
160-
161 return
never executed: return x == (x & -x);
x == (x & -x);
never executed: return x == (x & -x);
0
162}-
163-
164bool QSGDefaultInternalImageNode::supportsWrap(const QSize &size) const-
165{-
166 bool wrapSupported = true;-
167-
168 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
169-
170 if (ctx->isOpenGLES()
ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickimage
)
0-10
171-
172 {-
173 bool npotSupported = ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat);-
174 const bool isNpot = !isPowerOfTwo(size.width())
!isPowerOfTwo(size.width())Description
TRUEnever evaluated
FALSEnever evaluated
|| !isPowerOfTwo(size.height())
!isPowerOfTwo(size.height())Description
TRUEnever evaluated
FALSEnever evaluated
;
0
175 wrapSupported = npotSupported
npotSupportedDescription
TRUEnever evaluated
FALSEnever evaluated
|| !isNpot
!isNpotDescription
TRUEnever evaluated
FALSEnever evaluated
;
0
176 }
never executed: end of block
0
177-
178 return
executed 10 times by 1 test: return wrapSupported;
Executed by:
  • tst_qquickimage
wrapSupported;
executed 10 times by 1 test: return wrapSupported;
Executed by:
  • tst_qquickimage
10
179}-
180-
181-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0