OpenCoverage

qsgtexturematerial.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgtexturematerial.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7inline static bool isPowerOfTwo(int x)-
8{-
9-
10 return
never executed: return x == (x & -x);
x == (x & -x);
never executed: return x == (x & -x);
0
11}-
12-
13-
14QSGMaterialType QSGOpaqueTextureMaterialShader::type;-
15-
16QSGOpaqueTextureMaterialShader::QSGOpaqueTextureMaterialShader()-
17{-
18-
19 setShaderSourceFile(QOpenGLShader::Vertex, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/opaquetexture.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/opaquetexture.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 203 times by 12 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
qstring_literal_temp;
executed 203 times by 12 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
}()));
203
20 setShaderSourceFile(QOpenGLShader::Fragment, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/opaquetexture.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/opaquetexture.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 203 times by 12 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
qstring_literal_temp;
executed 203 times by 12 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
}()));
203
21-
22}
executed 203 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
203
23-
24char const *const *QSGOpaqueTextureMaterialShader::attributeNames() const-
25{-
26 static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", nullptr };-
27 return
executed 24511 times by 12 tests: return attr;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
attr;
executed 24511 times by 12 tests: return attr;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
24511
28}-
29-
30void QSGOpaqueTextureMaterialShader::initialize()-
31{-
32-
33 m_matrix_id = program()->uniformLocation("qt_Matrix");-
34-
35}
executed 203 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
203
36-
37void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)-
38{-
39 ((oldEffect == nullptr || newEffect->type() == oldEffect->type()) ? static_cast<void>(0) : qt_assert("oldEffect == nullptr || newEffect->type() == oldEffect->type()", __FILE__, 82));-
40 QSGOpaqueTextureMaterial *tx = static_cast<QSGOpaqueTextureMaterial *>(newEffect);-
41 QSGOpaqueTextureMaterial *oldTx = static_cast<QSGOpaqueTextureMaterial *>(oldEffect);-
42-
43 QSGTexture *t = tx->texture();-
44-
45-
46 if (!qsg_safeguard_texture(t)
!qsg_safeguard_texture(t)Description
TRUEnever evaluated
FALSEevaluated 20802 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
)
0-20802
47 return;
never executed: return;
0
48-
49-
50 t->setFiltering(tx->filtering());-
51-
52 t->setHorizontalWrapMode(tx->horizontalWrapMode());-
53 t->setVerticalWrapMode(tx->verticalWrapMode());-
54-
55 bool npotSupported = const_cast<QOpenGLContext *>(state.context())-
56 ->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat);-
57 if (!npotSupported
!npotSupportedDescription
TRUEnever evaluated
FALSEevaluated 20802 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
) {
0-20802
58 QSize size = t->textureSize();-
59 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
60 if (isNpot
isNpotDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
61 t->setHorizontalWrapMode(QSGTexture::ClampToEdge);-
62 t->setVerticalWrapMode(QSGTexture::ClampToEdge);-
63 }
never executed: end of block
0
64 }
never executed: end of block
0
65-
66-
67-
68 t->setMipmapFiltering(tx->mipmapFiltering());-
69 t->setAnisotropyLevel(tx->anisotropyLevel());-
70-
71 if (oldTx == nullptr
oldTx == nullptrDescription
TRUEevaluated 1753 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
FALSEevaluated 19049 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemparticle
  • tst_scenegraph
|| oldTx->texture()->textureId() != t->textureId()
oldTx->texture...t->textureId()Description
TRUEevaluated 260 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_scenegraph
FALSEevaluated 18789 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
  • tst_scenegraph
)
260-19049
72 t->bind();
executed 2013 times by 12 tests: t->bind();
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
2013
73 else-
74 t->updateBindOptions();
executed 18789 times by 3 tests: t->updateBindOptions();
Executed by:
  • tst_examples
  • tst_qquickitemparticle
  • tst_scenegraph
18789
75-
76 if (state.isMatrixDirty()
state.isMatrixDirty()Description
TRUEevaluated 20802 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
FALSEnever evaluated
)
0-20802
77 program()->setUniformValue(m_matrix_id, state.combinedMatrix());
executed 20802 times by 12 tests: program()->setUniformValue(m_matrix_id, state.combinedMatrix());
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
20802
78-
79}
executed 20802 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
20802
80QSGOpaqueTextureMaterial::QSGOpaqueTextureMaterial()-
81 : m_texture(nullptr)-
82 , m_filtering(QSGTexture::Nearest)-
83 , m_mipmap_filtering(QSGTexture::None)-
84 , m_horizontal_wrap(QSGTexture::ClampToEdge)-
85 , m_vertical_wrap(QSGTexture::ClampToEdge)-
86 , m_anisotropy_level(QSGTexture::AnisotropyNone)-
87{-
88}
executed 15635 times by 13 tests: end of block
Executed by:
  • tst_examples
  • tst_nodestest
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
15635
89-
90-
91-
92-
93-
94QSGMaterialType *QSGOpaqueTextureMaterial::type() const-
95{-
96 return
executed 95881 times by 12 tests: return &QSGOpaqueTextureMaterialShader::type;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
&QSGOpaqueTextureMaterialShader::type;
executed 95881 times by 12 tests: return &QSGOpaqueTextureMaterialShader::type;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
95881
97}-
98-
99-
100-
101-
102QSGMaterialShader *QSGOpaqueTextureMaterial::createShader() const-
103{-
104 return
executed 187 times by 12 tests: return new QSGOpaqueTextureMaterialShader;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
new QSGOpaqueTextureMaterialShader;
executed 187 times by 12 tests: return new QSGOpaqueTextureMaterialShader;
Executed by:
  • tst_examples
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
187
105}-
106void QSGOpaqueTextureMaterial::setTexture(QSGTexture *texture)-
107{-
108 m_texture = texture;-
109 setFlag(Blending, m_texture ? m_texture->hasAlphaChannel() : false);-
110}
executed 10610 times by 13 tests: end of block
Executed by:
  • tst_examples
  • tst_nodestest
  • tst_qquickanimatedimage
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickframebufferobject
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquickpainteditem
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_scenegraph
10610
111int QSGOpaqueTextureMaterial::compare(const QSGMaterial *o) const-
112{-
113 ((o && type() == o->type()) ? static_cast<void>(0) : qt_assert("o && type() == o->type()", __FILE__, 324));-
114 const QSGOpaqueTextureMaterial *other = static_cast<const QSGOpaqueTextureMaterial *>(o);-
115 if (int diff = m_texture->textureId() - other->texture()->textureId()
int diff = m_t...)->textureId()Description
TRUEevaluated 270 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_scenegraph
FALSEevaluated 24420 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
  • tst_scenegraph
)
270-24420
116 return
executed 270 times by 4 tests: return diff;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_scenegraph
diff;
executed 270 times by 4 tests: return diff;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_scenegraph
270
117 return
executed 24420 times by 3 tests: return int(m_filtering) - int(other->m_filtering);
Executed by:
  • tst_examples
  • tst_qquickitemparticle
  • tst_scenegraph
int(m_filtering) - int(other->m_filtering);
executed 24420 times by 3 tests: return int(m_filtering) - int(other->m_filtering);
Executed by:
  • tst_examples
  • tst_qquickitemparticle
  • tst_scenegraph
24420
118}-
119QSGMaterialType QSGTextureMaterialShader::type;-
120-
121-
122-
123-
124-
125-
126-
127QSGMaterialType *QSGTextureMaterial::type() const-
128{-
129 return
executed 98909 times by 5 tests: return &QSGTextureMaterialShader::type;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
&QSGTextureMaterialShader::type;
executed 98909 times by 5 tests: return &QSGTextureMaterialShader::type;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
98909
130}-
131-
132-
133-
134-
135-
136-
137-
138QSGMaterialShader *QSGTextureMaterial::createShader() const-
139{-
140 return
executed 16 times by 5 tests: return new QSGTextureMaterialShader;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
new QSGTextureMaterialShader;
executed 16 times by 5 tests: return new QSGTextureMaterialShader;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
16
141}-
142-
143QSGTextureMaterialShader::QSGTextureMaterialShader()-
144 : QSGOpaqueTextureMaterialShader()-
145{-
146-
147 setShaderSourceFile(QOpenGLShader::Fragment, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/texture.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/texture.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 16 times by 5 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
qstring_literal_temp;
executed 16 times by 5 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
}()));
16
148-
149}
executed 16 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
16
150-
151void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)-
152{-
153 ((oldEffect == nullptr || newEffect->type() == oldEffect->type()) ? static_cast<void>(0) : qt_assert("oldEffect == nullptr || newEffect->type() == oldEffect->type()", __FILE__, 400));-
154-
155 if (state.isOpacityDirty()
state.isOpacityDirty()Description
TRUEevaluated 18968 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
FALSEevaluated 181 times by 3 tests
Evaluated by:
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
)
181-18968
156 program()->setUniformValue(m_opacity_id, state.opacity());
executed 18968 times by 5 tests: program()->setUniformValue(m_opacity_id, state.opacity());
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
18968
157-
158 QSGOpaqueTextureMaterialShader::updateState(state, newEffect, oldEffect);-
159}
executed 19149 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
19149
160-
161void QSGTextureMaterialShader::initialize()-
162{-
163 QSGOpaqueTextureMaterialShader::initialize();-
164-
165 m_opacity_id = program()->uniformLocation("opacity");-
166-
167}
executed 16 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_scenegraph
16
168-
169-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0