OpenCoverage

qsgdefaultglyphnode.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgdefaultglyphnode.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4QSGDefaultGlyphNode::QSGDefaultGlyphNode()-
5 : m_glyphNodeType(RootGlyphNode)-
6 , m_dirtyGeometry(false)-
7{-
8 setFlag(UsePreprocess);-
9}
executed 72 times by 1 test: end of block
Executed by:
  • tst_scenegraph
72
10-
11QSGDefaultGlyphNode::~QSGDefaultGlyphNode()-
12{-
13 if (m_glyphNodeType == SubGlyphNode
m_glyphNodeTyp...= SubGlyphNodeDescription
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_scenegraph
)
0-72
14 return;
never executed: return;
0
15-
16 qDeleteAll(m_nodesToDelete);-
17 m_nodesToDelete.clear();-
18}
executed 72 times by 1 test: end of block
Executed by:
  • tst_scenegraph
72
19-
20void QSGDefaultGlyphNode::setMaterialColor(const QColor &color)-
21{-
22 static_cast<QSGTextMaskMaterial *>(m_material)->setColor(color);-
23}
never executed: end of block
0
24-
25void QSGDefaultGlyphNode::setGlyphs(const QPointF &position, const QGlyphRun &glyphs)-
26{-
27 QSGBasicGlyphNode::setGlyphs(position, glyphs);-
28 m_dirtyGeometry = true;-
29}
executed 72 times by 1 test: end of block
Executed by:
  • tst_scenegraph
72
30-
31void QSGDefaultGlyphNode::update()-
32{-
33 QRawFont font = m_glyphs.rawFont();-
34 QMargins margins(0, 0, 0, 0);-
35-
36 if (m_style == QQuickText::Normal
m_style == QQuickText::NormalDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_scenegraph
FALSEnever evaluated
) {
0-72
37 m_material = new QSGTextMaskMaterial(font);-
38 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_scenegraph
else if (m_style == QQuickText::Outline
m_style == QQuickText::OutlineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-72
39 QSGOutlinedTextMaterial *material = new QSGOutlinedTextMaterial(font);-
40 material->setStyleColor(m_styleColor);-
41 m_material = material;-
42 margins = QMargins(1, 1, 1, 1);-
43 }
never executed: end of block
else {
0
44 QSGStyledTextMaterial *material = new QSGStyledTextMaterial(font);-
45 if (m_style == QQuickText::Sunken
m_style == QQuickText::SunkenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
46 material->setStyleShift(QVector2D(0, -1));-
47 margins.setTop(1);-
48 }
never executed: end of block
else if (m_style == QQuickText::Raised
m_style == QQuickText::RaisedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
49 material->setStyleShift(QVector2D(0, 1));-
50 margins.setBottom(1);-
51 }
never executed: end of block
0
52 material->setStyleColor(m_styleColor);-
53 m_material = material;-
54 }
never executed: end of block
0
55-
56 QSGTextMaskMaterial *textMaskMaterial = static_cast<QSGTextMaskMaterial *>(m_material);-
57 textMaskMaterial->setColor(m_color);-
58-
59 QRectF boundingRect;-
60 textMaskMaterial->populate(m_position, m_glyphs.glyphIndexes(), m_glyphs.positions(), geometry(),-
61 &boundingRect, &m_baseLine, margins);-
62 setBoundingRect(boundingRect);-
63-
64 setMaterial(m_material);-
65 markDirty(DirtyGeometry);-
66}
executed 72 times by 1 test: end of block
Executed by:
  • tst_scenegraph
72
67-
68void QSGDefaultGlyphNode::preprocess()-
69{-
70 qDeleteAll(m_nodesToDelete);-
71 m_nodesToDelete.clear();-
72-
73 if (m_dirtyGeometry
m_dirtyGeometryDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_scenegraph
FALSEevaluated 144 times by 1 test
Evaluated by:
  • tst_scenegraph
)
72-144
74 updateGeometry();
executed 72 times by 1 test: updateGeometry();
Executed by:
  • tst_scenegraph
72
75}
executed 216 times by 1 test: end of block
Executed by:
  • tst_scenegraph
216
76-
77void QSGDefaultGlyphNode::updateGeometry()-
78{-
79-
80-
81 QSGNode *subnode = firstChild();-
82 while (subnode
subnodeDescription
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_scenegraph
) {
0-72
83-
84-
85 m_nodesToDelete.append(subnode);-
86 subnode = subnode->nextSibling();-
87 }
never executed: end of block
0
88 removeAllChildNodes();-
89-
90 GlyphInfo glyphInfo;-
91-
92 const QVector<quint32> indexes = m_glyphs.glyphIndexes();-
93 const QVector<QPointF> positions = m_glyphs.positions();-
94-
95 const int maxGlyphs = (-
96 (0x7fff * 2 + 1) -
97 + 1) / 4;-
98 const int maxVertices = maxGlyphs * 4;-
99 const int maxIndexes = maxGlyphs * 6;-
100-
101 for (int i = 0; i < indexes.size()
i < indexes.size()Description
TRUEevaluated 4968 times by 1 test
Evaluated by:
  • tst_scenegraph
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_scenegraph
; ++i) {
72-4968
102 const int glyphIndex = indexes.at(i);-
103 const QPointF position = positions.at(i);-
104-
105-
106-
107-
108-
109-
110 if (i >= maxGlyphs
i >= maxGlyphsDescription
TRUEnever evaluated
FALSEevaluated 4968 times by 1 test
Evaluated by:
  • tst_scenegraph
) {
0-4968
111 glyphInfo.indexes.append(glyphIndex);-
112 glyphInfo.positions.append(position);-
113 continue;
never executed: continue;
0
114 }-
115 }
executed 4968 times by 1 test: end of block
Executed by:
  • tst_scenegraph
4968
116-
117 if (!glyphInfo.indexes.isEmpty()
!glyphInfo.indexes.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_scenegraph
) {
0-72
118 QGlyphRun subNodeGlyphRun(m_glyphs);-
119 subNodeGlyphRun.setGlyphIndexes(glyphInfo.indexes);-
120 subNodeGlyphRun.setPositions(glyphInfo.positions);-
121-
122 QSGDefaultGlyphNode *subNode = new QSGDefaultGlyphNode();-
123 subNode->setGlyphNodeType(SubGlyphNode);-
124 subNode->setColor(m_color);-
125 subNode->setStyle(m_style);-
126 subNode->setStyleColor(m_styleColor);-
127 subNode->setGlyphs(m_position, subNodeGlyphRun);-
128 subNode->update();-
129 subNode->updateGeometry();-
130 appendChildNode(subNode);-
131-
132 QSGGeometry *g = geometry();-
133-
134 QSGGeometry::TexturedPoint2D *vertexData = g->vertexDataAsTexturedPoint2D();-
135 quint16 *indexData = g->indexDataAsUShort();-
136-
137 QVector<QSGGeometry::TexturedPoint2D> tempVertexData(maxVertices);-
138 QVector<quint16> tempIndexData(maxIndexes);-
139-
140 for (int i = 0; i < maxGlyphs
i < maxGlyphsDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
141 tempVertexData[i * 4 + 0] = vertexData[i * 4 + 0];-
142 tempVertexData[i * 4 + 1] = vertexData[i * 4 + 1];-
143 tempVertexData[i * 4 + 2] = vertexData[i * 4 + 2];-
144 tempVertexData[i * 4 + 3] = vertexData[i * 4 + 3];-
145-
146 tempIndexData[i * 6 + 0] = indexData[i * 6 + 0];-
147 tempIndexData[i * 6 + 1] = indexData[i * 6 + 1];-
148 tempIndexData[i * 6 + 2] = indexData[i * 6 + 2];-
149 tempIndexData[i * 6 + 3] = indexData[i * 6 + 3];-
150 tempIndexData[i * 6 + 4] = indexData[i * 6 + 4];-
151 tempIndexData[i * 6 + 5] = indexData[i * 6 + 5];-
152 }
never executed: end of block
0
153-
154 g->allocate(maxVertices, maxIndexes);-
155 vertexData = g->vertexDataAsTexturedPoint2D();-
156 indexData = g->indexDataAsUShort();-
157-
158 for (int i = 0; i < maxGlyphs
i < maxGlyphsDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
159 vertexData[i * 4 + 0] = tempVertexData[i * 4 + 0];-
160 vertexData[i * 4 + 1] = tempVertexData[i * 4 + 1];-
161 vertexData[i * 4 + 2] = tempVertexData[i * 4 + 2];-
162 vertexData[i * 4 + 3] = tempVertexData[i * 4 + 3];-
163-
164 indexData[i * 6 + 0] = tempIndexData[i * 6 + 0];-
165 indexData[i * 6 + 1] = tempIndexData[i * 6 + 1];-
166 indexData[i * 6 + 2] = tempIndexData[i * 6 + 2];-
167 indexData[i * 6 + 3] = tempIndexData[i * 6 + 3];-
168 indexData[i * 6 + 4] = tempIndexData[i * 6 + 4];-
169 indexData[i * 6 + 5] = tempIndexData[i * 6 + 5];-
170 }
never executed: end of block
0
171 }
never executed: end of block
0
172-
173 m_dirtyGeometry = false;-
174}
executed 72 times by 1 test: end of block
Executed by:
  • tst_scenegraph
72
175-
176-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0