OpenCoverage

qsgflatcolormaterial.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6class FlatColorMaterialShader : public QSGMaterialShader-
7{-
8public:-
9 FlatColorMaterialShader();-
10-
11 void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;-
12 char const *const *attributeNames() const override;-
13-
14 static QSGMaterialType type;-
15-
16private:-
17 void initialize() override;-
18-
19 int m_matrix_id;-
20 int m_color_id;-
21-
22};-
23-
24QSGMaterialType FlatColorMaterialShader::type;-
25-
26FlatColorMaterialShader::FlatColorMaterialShader()-
27 : QSGMaterialShader(*new QSGMaterialShaderPrivate)-
28{-
29-
30 setShaderSourceFile(QOpenGLShader::Vertex, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/flatcolor.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/flatcolor.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 6 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
qstring_literal_temp;
executed 6 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
}()));
6
31 setShaderSourceFile(QOpenGLShader::Fragment, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/flatcolor.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/flatcolor.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 6 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
qstring_literal_temp;
executed 6 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
}()));
6
32-
33}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
6
34-
35void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)-
36{-
37-
38 ((oldEffect == nullptr || newEffect->type() == oldEffect->type()) ? static_cast<void>(0) : qt_assert("oldEffect == nullptr || newEffect->type() == oldEffect->type()", __FILE__, 80));-
39 QSGFlatColorMaterial *oldMaterial = static_cast<QSGFlatColorMaterial *>(oldEffect);-
40 QSGFlatColorMaterial *newMaterial = static_cast<QSGFlatColorMaterial *>(newEffect);-
41-
42 const QColor &c = newMaterial->color();-
43-
44 if (oldMaterial == nullptr
oldMaterial == nullptrDescription
TRUEevaluated 78 times by 2 tests
Evaluated by:
  • tst_drawingmodes
  • tst_scenegraph
FALSEevaluated 52 times by 2 tests
Evaluated by:
  • tst_drawingmodes
  • tst_scenegraph
|| c != oldMaterial->color()
c != oldMaterial->color()Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_scenegraph
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_drawingmodes
|| state.isOpacityDirty()
state.isOpacityDirty()Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_drawingmodes
) {
0-78
45 float opacity = state.opacity() * c.alphaF();-
46 QVector4D v(c.redF() * opacity,-
47 c.greenF() * opacity,-
48 c.blueF() * opacity,-
49 opacity);-
50 program()->setUniformValue(m_color_id, v);-
51 }
executed 110 times by 2 tests: end of block
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
110
52-
53 if (state.isMatrixDirty()
state.isMatrixDirty()Description
TRUEevaluated 130 times by 2 tests
Evaluated by:
  • tst_drawingmodes
  • tst_scenegraph
FALSEnever evaluated
)
0-130
54 program()->setUniformValue(m_matrix_id, state.combinedMatrix());
executed 130 times by 2 tests: program()->setUniformValue(m_matrix_id, state.combinedMatrix());
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
130
55-
56-
57-
58-
59-
60}
executed 130 times by 2 tests: end of block
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
130
61-
62char const *const *FlatColorMaterialShader::attributeNames() const-
63{-
64 static char const *const attr[] = { "vCoord", nullptr };-
65 return
executed 292 times by 2 tests: return attr;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
attr;
executed 292 times by 2 tests: return attr;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
292
66}-
67-
68void FlatColorMaterialShader::initialize()-
69{-
70-
71 m_matrix_id = program()->uniformLocation("matrix");-
72 m_color_id = program()->uniformLocation("color");-
73-
74}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
6
75QSGFlatColorMaterial::QSGFlatColorMaterial() : m_color(QColor(255, 255, 255))-
76{-
77}
executed 200024 times by 4 tests: end of block
Executed by:
  • tst_drawingmodes
  • tst_nodestest
  • tst_qquickshape
  • tst_scenegraph
200024
78void QSGFlatColorMaterial::setColor(const QColor &color)-
79{-
80 m_color = color;-
81 setFlag(Blending, m_color.alpha() != 0xff);-
82}
executed 200014 times by 2 tests: end of block
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
200014
83-
84-
85-
86-
87-
88-
89-
90QSGMaterialType *QSGFlatColorMaterial::type() const-
91{-
92 return
executed 1800194 times by 2 tests: return &FlatColorMaterialShader::type;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
&FlatColorMaterialShader::type;
executed 1800194 times by 2 tests: return &FlatColorMaterialShader::type;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
1800194
93}-
94-
95-
96-
97-
98-
99-
100-
101QSGMaterialShader *QSGFlatColorMaterial::createShader() const-
102{-
103 return
executed 6 times by 2 tests: return new FlatColorMaterialShader;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
new FlatColorMaterialShader;
executed 6 times by 2 tests: return new FlatColorMaterialShader;
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
6
104}-
105-
106-
107-
108-
109-
110-
111int QSGFlatColorMaterial::compare(const QSGMaterial *other) const-
112{-
113 const QSGFlatColorMaterial *flat = static_cast<const QSGFlatColorMaterial *>(other);-
114 return
executed 899990 times by 2 tests: return m_color.rgba() - flat->color().rgba();
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
m_color.rgba() - flat->color().rgba();
executed 899990 times by 2 tests: return m_color.rgba() - flat->color().rgba();
Executed by:
  • tst_drawingmodes
  • tst_scenegraph
899990
115-
116}-
117-
118-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0