Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgadaptationlayer_p.h |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | class QSGNode; | - | ||||||
7 | class QImage; | - | ||||||
8 | class TextureReference; | - | ||||||
9 | class QSGDistanceFieldGlyphNode; | - | ||||||
10 | class QOpenGLContext; | - | ||||||
11 | class QSGInternalImageNode; | - | ||||||
12 | class QSGPainterNode; | - | ||||||
13 | class QSGInternalRectangleNode; | - | ||||||
14 | class QSGGlyphNode; | - | ||||||
15 | class QSGRootNode; | - | ||||||
16 | class QSGSpriteNode; | - | ||||||
17 | class QSGRenderNode; | - | ||||||
18 | - | |||||||
19 | class __attribute__((visibility("default"))) QSGNodeVisitorEx | - | ||||||
20 | { | - | ||||||
21 | public: | - | ||||||
22 | virtual ~QSGNodeVisitorEx() {} | - | ||||||
23 | - | |||||||
24 | - | |||||||
25 | - | |||||||
26 | - | |||||||
27 | virtual bool visit(QSGTransformNode *) = 0; | - | ||||||
28 | virtual void endVisit(QSGTransformNode *) = 0; | - | ||||||
29 | virtual bool visit(QSGClipNode *) = 0; | - | ||||||
30 | virtual void endVisit(QSGClipNode *) = 0; | - | ||||||
31 | virtual bool visit(QSGGeometryNode *) = 0; | - | ||||||
32 | virtual void endVisit(QSGGeometryNode *) = 0; | - | ||||||
33 | virtual bool visit(QSGOpacityNode *) = 0; | - | ||||||
34 | virtual void endVisit(QSGOpacityNode *) = 0; | - | ||||||
35 | virtual bool visit(QSGInternalImageNode *) = 0; | - | ||||||
36 | virtual void endVisit(QSGInternalImageNode *) = 0; | - | ||||||
37 | virtual bool visit(QSGPainterNode *) = 0; | - | ||||||
38 | virtual void endVisit(QSGPainterNode *) = 0; | - | ||||||
39 | virtual bool visit(QSGInternalRectangleNode *) = 0; | - | ||||||
40 | virtual void endVisit(QSGInternalRectangleNode *) = 0; | - | ||||||
41 | virtual bool visit(QSGGlyphNode *) = 0; | - | ||||||
42 | virtual void endVisit(QSGGlyphNode *) = 0; | - | ||||||
43 | virtual bool visit(QSGRootNode *) = 0; | - | ||||||
44 | virtual void endVisit(QSGRootNode *) = 0; | - | ||||||
45 | - | |||||||
46 | virtual bool visit(QSGSpriteNode *) = 0; | - | ||||||
47 | virtual void endVisit(QSGSpriteNode *) = 0; | - | ||||||
48 | - | |||||||
49 | virtual bool visit(QSGRenderNode *) = 0; | - | ||||||
50 | virtual void endVisit(QSGRenderNode *) = 0; | - | ||||||
51 | - | |||||||
52 | void visitChildren(QSGNode *node); | - | ||||||
53 | }; | - | ||||||
54 | - | |||||||
55 | - | |||||||
56 | class __attribute__((visibility("default"))) QSGVisitableNode : public QSGGeometryNode | - | ||||||
57 | { | - | ||||||
58 | public: | - | ||||||
59 | QSGVisitableNode() { setFlag(IsVisitableNode); } executed 326527 times by 70 tests: end of block Executed by:
| 326527 | ||||||
60 | - | |||||||
61 | virtual void accept(QSGNodeVisitorEx *) = 0; | - | ||||||
62 | }; | - | ||||||
63 | - | |||||||
64 | class __attribute__((visibility("default"))) QSGInternalRectangleNode : public QSGVisitableNode | - | ||||||
65 | { | - | ||||||
66 | public: | - | ||||||
67 | virtual void setRect(const QRectF &rect) = 0; | - | ||||||
68 | virtual void setColor(const QColor &color) = 0; | - | ||||||
69 | virtual void setPenColor(const QColor &color) = 0; | - | ||||||
70 | virtual void setPenWidth(qreal width) = 0; | - | ||||||
71 | virtual void setGradientStops(const QGradientStops &stops) = 0; | - | ||||||
72 | virtual void setGradientVertical(bool vertical) = 0; | - | ||||||
73 | virtual void setRadius(qreal radius) = 0; | - | ||||||
74 | virtual void setAntialiasing(bool antialiasing) { (void)antialiasing; } never executed: end of block | 0 | ||||||
75 | virtual void setAligned(bool aligned) = 0; | - | ||||||
76 | - | |||||||
77 | virtual void update() = 0; | - | ||||||
78 | - | |||||||
79 | void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)
never executed: visitor->endVisit(this); }visitor->visitChildren(this); never executed: end of block | 0 | ||||||
80 | }; | - | ||||||
81 | - | |||||||
82 | - | |||||||
83 | class __attribute__((visibility("default"))) QSGInternalImageNode : public QSGVisitableNode | - | ||||||
84 | { | - | ||||||
85 | public: | - | ||||||
86 | virtual void setTargetRect(const QRectF &rect) = 0; | - | ||||||
87 | virtual void setInnerTargetRect(const QRectF &rect) = 0; | - | ||||||
88 | virtual void setInnerSourceRect(const QRectF &rect) = 0; | - | ||||||
89 | - | |||||||
90 | - | |||||||
91 | - | |||||||
92 | virtual void setSubSourceRect(const QRectF &rect) = 0; | - | ||||||
93 | virtual void setTexture(QSGTexture *texture) = 0; | - | ||||||
94 | virtual void setAntialiasing(bool antialiasing) { (void)antialiasing; } never executed: end of block | 0 | ||||||
95 | virtual void setMirror(bool mirror) = 0; | - | ||||||
96 | virtual void setMipmapFiltering(QSGTexture::Filtering filtering) = 0; | - | ||||||
97 | virtual void setFiltering(QSGTexture::Filtering filtering) = 0; | - | ||||||
98 | virtual void setHorizontalWrapMode(QSGTexture::WrapMode wrapMode) = 0; | - | ||||||
99 | virtual void setVerticalWrapMode(QSGTexture::WrapMode wrapMode) = 0; | - | ||||||
100 | - | |||||||
101 | virtual void update() = 0; | - | ||||||
102 | - | |||||||
103 | void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)
never executed: visitor->endVisit(this); }visitor->visitChildren(this); never executed: end of block | 0 | ||||||
104 | }; | - | ||||||
105 | - | |||||||
106 | class __attribute__((visibility("default"))) QSGPainterNode : public QSGVisitableNode | - | ||||||
107 | { | - | ||||||
108 | public: | - | ||||||
109 | - | |||||||
110 | virtual void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) = 0; | - | ||||||
111 | virtual void setSize(const QSize &size) = 0; | - | ||||||
112 | virtual void setDirty(const QRect &dirtyRect = QRect()) = 0; | - | ||||||
113 | virtual void setOpaquePainting(bool opaque) = 0; | - | ||||||
114 | virtual void setLinearFiltering(bool linearFiltering) = 0; | - | ||||||
115 | virtual void setMipmapping(bool mipmapping) = 0; | - | ||||||
116 | virtual void setSmoothPainting(bool s) = 0; | - | ||||||
117 | virtual void setFillColor(const QColor &c) = 0; | - | ||||||
118 | virtual void setContentsScale(qreal s) = 0; | - | ||||||
119 | virtual void setFastFBOResizing(bool dynamic) = 0; | - | ||||||
120 | virtual void setTextureSize(const QSize &size) = 0; | - | ||||||
121 | - | |||||||
122 | virtual QImage toImage() const = 0; | - | ||||||
123 | virtual void update() = 0; | - | ||||||
124 | virtual QSGTexture *texture() const = 0; | - | ||||||
125 | - | |||||||
126 | void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)
never executed: visitor->endVisit(this); }visitor->visitChildren(this); never executed: end of block | 0 | ||||||
127 | }; | - | ||||||
128 | - | |||||||
129 | class __attribute__((visibility("default"))) QSGLayer : public QSGDynamicTexture | - | ||||||
130 | { | - | ||||||
131 | public: | - | ||||||
132 | #pragma GCC diagnostic push | - | ||||||
133 | - | |||||||
134 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||
135 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||
136 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||
137 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||
138 | #pragma GCC diagnostic pop | - | ||||||
139 | struct QPrivateSignal {}; | - | ||||||
140 | public: | - | ||||||
141 | virtual void setItem(QSGNode *item) = 0; | - | ||||||
142 | virtual void setRect(const QRectF &rect) = 0; | - | ||||||
143 | virtual void setSize(const QSize &size) = 0; | - | ||||||
144 | virtual void scheduleUpdate() = 0; | - | ||||||
145 | virtual QImage toImage() const = 0; | - | ||||||
146 | virtual void setLive(bool live) = 0; | - | ||||||
147 | virtual void setRecursive(bool recursive) = 0; | - | ||||||
148 | virtual void setFormat(uint format) = 0; | - | ||||||
149 | virtual void setHasMipmaps(bool mipmap) = 0; | - | ||||||
150 | virtual void setDevicePixelRatio(qreal ratio) = 0; | - | ||||||
151 | virtual void setMirrorHorizontal(bool mirror) = 0; | - | ||||||
152 | virtual void setMirrorVertical(bool mirror) = 0; | - | ||||||
153 | virtual void setSamples(int samples) = 0; | - | ||||||
154 | virtual void markDirtyTexture() = 0; | - | ||||||
155 | virtual void invalidated() = 0; | - | ||||||
156 | - | |||||||
157 | public : | - | ||||||
158 | void updateRequested(); | - | ||||||
159 | void scheduledUpdateCompleted(); | - | ||||||
160 | }; | - | ||||||
161 | - | |||||||
162 | - | |||||||
163 | - | |||||||
164 | class __attribute__((visibility("default"))) QSGSpriteNode : public QSGVisitableNode | - | ||||||
165 | { | - | ||||||
166 | public: | - | ||||||
167 | virtual void setTexture(QSGTexture *texture) = 0; | - | ||||||
168 | virtual void setTime(float time) = 0; | - | ||||||
169 | virtual void setSourceA(const QPoint &source) = 0; | - | ||||||
170 | virtual void setSourceB(const QPoint &source) = 0; | - | ||||||
171 | virtual void setSpriteSize(const QSize &size) = 0; | - | ||||||
172 | virtual void setSheetSize(const QSize &size) = 0; | - | ||||||
173 | virtual void setSize(const QSizeF &size) = 0; | - | ||||||
174 | virtual void setFiltering(QSGTexture::Filtering filtering) = 0; | - | ||||||
175 | - | |||||||
176 | virtual void update() = 0; | - | ||||||
177 | - | |||||||
178 | void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)
never executed: visitor->endVisit(this); }visitor->visitChildren(this); never executed: end of block | 0 | ||||||
179 | }; | - | ||||||
180 | - | |||||||
181 | - | |||||||
182 | - | |||||||
183 | class __attribute__((visibility("default"))) QSGGuiThreadShaderEffectManager : public QObject | - | ||||||
184 | { | - | ||||||
185 | public: | - | ||||||
186 | #pragma GCC diagnostic push | - | ||||||
187 | - | |||||||
188 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||
189 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||
190 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||
191 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||
192 | #pragma GCC diagnostic pop | - | ||||||
193 | struct QPrivateSignal {}; | - | ||||||
194 | - | |||||||
195 | public: | - | ||||||
196 | enum Status { | - | ||||||
197 | Compiled, | - | ||||||
198 | Uncompiled, | - | ||||||
199 | Error | - | ||||||
200 | }; | - | ||||||
201 | - | |||||||
202 | virtual bool hasSeparateSamplerAndTextureObjects() const = 0; | - | ||||||
203 | - | |||||||
204 | virtual QString log() const = 0; | - | ||||||
205 | virtual Status status() const = 0; | - | ||||||
206 | - | |||||||
207 | struct ShaderInfo { | - | ||||||
208 | enum Type { | - | ||||||
209 | TypeVertex, | - | ||||||
210 | TypeFragment, | - | ||||||
211 | TypeOther | - | ||||||
212 | }; | - | ||||||
213 | enum VariableType { | - | ||||||
214 | Constant, | - | ||||||
215 | Sampler, | - | ||||||
216 | Texture | - | ||||||
217 | }; | - | ||||||
218 | struct InputParameter { | - | ||||||
219 | InputParameter() {} | - | ||||||
220 | - | |||||||
221 | - | |||||||
222 | QByteArray semanticName; | - | ||||||
223 | int semanticIndex = 0; | - | ||||||
224 | }; | - | ||||||
225 | struct Variable { | - | ||||||
226 | Variable() {} | - | ||||||
227 | VariableType type = Constant; | - | ||||||
228 | QByteArray name; | - | ||||||
229 | uint offset = 0; | - | ||||||
230 | uint size = 0; | - | ||||||
231 | int bindPoint = 0; | - | ||||||
232 | }; | - | ||||||
233 | - | |||||||
234 | QByteArray blob; | - | ||||||
235 | Type type; | - | ||||||
236 | QVector<InputParameter> inputParameters; | - | ||||||
237 | QVector<Variable> variables; | - | ||||||
238 | uint constantDataSize; | - | ||||||
239 | }; | - | ||||||
240 | - | |||||||
241 | virtual void prepareShaderCode(ShaderInfo::Type typeHint, const QByteArray &src, ShaderInfo *result) = 0; | - | ||||||
242 | - | |||||||
243 | public : | - | ||||||
244 | void shaderCodePrepared(bool ok, ShaderInfo::Type typeHint, const QByteArray &src, ShaderInfo *result); | - | ||||||
245 | void textureChanged(); | - | ||||||
246 | void logAndStatusChanged(); | - | ||||||
247 | }; | - | ||||||
248 | - | |||||||
249 | - | |||||||
250 | __attribute__((visibility("default"))) QDebug operator<<(QDebug debug, const QSGGuiThreadShaderEffectManager::ShaderInfo::InputParameter &p); | - | ||||||
251 | __attribute__((visibility("default"))) QDebug operator<<(QDebug debug, const QSGGuiThreadShaderEffectManager::ShaderInfo::Variable &v); | - | ||||||
252 | - | |||||||
253 | - | |||||||
254 | class __attribute__((visibility("default"))) QSGShaderEffectNode : public QSGVisitableNode | - | ||||||
255 | { | - | ||||||
256 | public: | - | ||||||
257 | enum DirtyShaderFlag { | - | ||||||
258 | DirtyShaders = 0x01, | - | ||||||
259 | DirtyShaderConstant = 0x02, | - | ||||||
260 | DirtyShaderTexture = 0x04, | - | ||||||
261 | DirtyShaderGeometry = 0x08, | - | ||||||
262 | DirtyShaderMesh = 0x10, | - | ||||||
263 | - | |||||||
264 | DirtyShaderAll = 0xFF | - | ||||||
265 | }; | - | ||||||
266 | typedef QFlags<DirtyShaderFlag> DirtyShaderFlags; | - | ||||||
267 | - | |||||||
268 | enum CullMode { | - | ||||||
269 | NoCulling, | - | ||||||
270 | BackFaceCulling, | - | ||||||
271 | FrontFaceCulling | - | ||||||
272 | }; | - | ||||||
273 | - | |||||||
274 | struct VariableData { | - | ||||||
275 | enum SpecialType { None, Unused, Source, SubRect, Opacity, Matrix }; | - | ||||||
276 | - | |||||||
277 | QVariant value; | - | ||||||
278 | SpecialType specialType; | - | ||||||
279 | }; | - | ||||||
280 | - | |||||||
281 | struct ShaderData { | - | ||||||
282 | ShaderData() {} | - | ||||||
283 | bool hasShaderCode = false; | - | ||||||
284 | QSGGuiThreadShaderEffectManager::ShaderInfo shaderInfo; | - | ||||||
285 | QVector<VariableData> varData; | - | ||||||
286 | }; | - | ||||||
287 | - | |||||||
288 | struct SyncData { | - | ||||||
289 | DirtyShaderFlags dirty; | - | ||||||
290 | CullMode cullMode; | - | ||||||
291 | bool blending; | - | ||||||
292 | struct ShaderSyncData { | - | ||||||
293 | const ShaderData *shader; | - | ||||||
294 | const QSet<int> *dirtyConstants; | - | ||||||
295 | const QSet<int> *dirtyTextures; | - | ||||||
296 | }; | - | ||||||
297 | ShaderSyncData vertex; | - | ||||||
298 | ShaderSyncData fragment; | - | ||||||
299 | }; | - | ||||||
300 | - | |||||||
301 | - | |||||||
302 | QSGShaderEffectNode(QSGGuiThreadShaderEffectManager *) { } | - | ||||||
303 | - | |||||||
304 | virtual QRectF updateNormalizedTextureSubRect(bool supportsAtlasTextures) = 0; | - | ||||||
305 | virtual void syncMaterial(SyncData *syncData) = 0; | - | ||||||
306 | - | |||||||
307 | void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)
never executed: visitor->endVisit(this); }visitor->visitChildren(this); never executed: end of block | 0 | ||||||
308 | }; | - | ||||||
309 | - | |||||||
310 | constexpr inline QFlags<QSGShaderEffectNode::DirtyShaderFlags::enum_type> operator|(QSGShaderEffectNode::DirtyShaderFlags::enum_type f1, QSGShaderEffectNode::DirtyShaderFlags::enum_type f2) noexcept { return QFlags<QSGShaderEffectNode::DirtyShaderFlags::enum_type>(f1) | f2; } constexpr inline QFlags<QSGShaderEffectNode::DirtyShaderFlags::enum_type> operator|(QSGShaderEffectNode::DirtyShaderFlags::enum_type f1, QFlags<QSGShaderEffectNode::DirtyShaderFlags::enum_type> f2) noexcept { return f2 | f1; } constexpr inline QIncompatibleFlag operator|(QSGShaderEffectNode::DirtyShaderFlags::enum_type f1, int f2) noexcept { return QIncompatibleFlag(int(f1) | f2); } | - | ||||||
311 | - | |||||||
312 | - | |||||||
313 | __attribute__((visibility("default"))) QDebug operator<<(QDebug debug, const QSGShaderEffectNode::VariableData &vd); | - | ||||||
314 | - | |||||||
315 | - | |||||||
316 | class __attribute__((visibility("default"))) QSGGlyphNode : public QSGVisitableNode | - | ||||||
317 | { | - | ||||||
318 | public: | - | ||||||
319 | enum AntialiasingMode | - | ||||||
320 | { | - | ||||||
321 | GrayAntialiasing, | - | ||||||
322 | LowQualitySubPixelAntialiasing, | - | ||||||
323 | HighQualitySubPixelAntialiasing | - | ||||||
324 | }; | - | ||||||
325 | - | |||||||
326 | QSGGlyphNode() {} | - | ||||||
327 | - | |||||||
328 | virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) = 0; | - | ||||||
329 | virtual void setColor(const QColor &color) = 0; | - | ||||||
330 | virtual void setStyle(QQuickText::TextStyle style) = 0; | - | ||||||
331 | virtual void setStyleColor(const QColor &color) = 0; | - | ||||||
332 | virtual QPointF baseLine() const = 0; | - | ||||||
333 | - | |||||||
334 | virtual QRectF boundingRect() const { return never executed: m_bounding_rect;return m_bounding_rect; never executed: }return m_bounding_rect; | 0 | ||||||
335 | virtual void setBoundingRect(const QRectF &bounds) { m_bounding_rect = bounds; } executed 240986 times by 25 tests: end of block Executed by:
| 240986 | ||||||
336 | - | |||||||
337 | virtual void setPreferredAntialiasingMode(AntialiasingMode) = 0; | - | ||||||
338 | - | |||||||
339 | virtual void update() = 0; | - | ||||||
340 | - | |||||||
341 | void setOwnerElement(QQuickItem *ownerElement) { m_ownerElement = ownerElement; } executed 249213 times by 25 tests: end of block Executed by:
| 249213 | ||||||
342 | QQuickItem *ownerElement() const { return executed 747423 times by 25 tests: m_ownerElement;return m_ownerElement; Executed by:
executed 747423 times by 25 tests: }return m_ownerElement; Executed by:
| 747423 | ||||||
343 | - | |||||||
344 | void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)
never executed: visitor->endVisit(this); }visitor->visitChildren(this); never executed: end of block | 0 | ||||||
345 | protected: | - | ||||||
346 | QRectF m_bounding_rect; | - | ||||||
347 | QQuickItem *m_ownerElement = nullptr; | - | ||||||
348 | }; | - | ||||||
349 | - | |||||||
350 | class __attribute__((visibility("default"))) QSGDistanceFieldGlyphConsumer | - | ||||||
351 | { | - | ||||||
352 | public: | - | ||||||
353 | virtual ~QSGDistanceFieldGlyphConsumer() {} | - | ||||||
354 | - | |||||||
355 | virtual void invalidateGlyphs(const QVector<quint32> &glyphs) = 0; | - | ||||||
356 | QIntrusiveListNode node; | - | ||||||
357 | }; | - | ||||||
358 | typedef QIntrusiveList<QSGDistanceFieldGlyphConsumer, &QSGDistanceFieldGlyphConsumer::node> QSGDistanceFieldGlyphConsumerList; | - | ||||||
359 | - | |||||||
360 | class __attribute__((visibility("default"))) QSGDistanceFieldGlyphCache | - | ||||||
361 | { | - | ||||||
362 | public: | - | ||||||
363 | QSGDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font); | - | ||||||
364 | virtual ~QSGDistanceFieldGlyphCache(); | - | ||||||
365 | - | |||||||
366 | struct Metrics { | - | ||||||
367 | qreal width; | - | ||||||
368 | qreal height; | - | ||||||
369 | qreal baselineX; | - | ||||||
370 | qreal baselineY; | - | ||||||
371 | - | |||||||
372 | bool isNull() const { return executed 1248303 times by 25 tests: width == 0 || height == 0;return width == 0 || height == 0; Executed by:
executed 1248303 times by 25 tests: }return width == 0 || height == 0; Executed by:
| 1248303 | ||||||
373 | }; | - | ||||||
374 | - | |||||||
375 | struct TexCoord { | - | ||||||
376 | qreal x = 0; | - | ||||||
377 | qreal y = 0; | - | ||||||
378 | qreal width = -1; | - | ||||||
379 | qreal height = -1; | - | ||||||
380 | qreal xMargin = 0; | - | ||||||
381 | qreal yMargin = 0; | - | ||||||
382 | - | |||||||
383 | TexCoord() {} | - | ||||||
384 | - | |||||||
385 | bool isNull() const { return executed 2714686 times by 25 tests: width <= 0 || height <= 0;return width <= 0 || height <= 0; Executed by:
executed 2714686 times by 25 tests: }return width <= 0 || height <= 0; Executed by:
| 2714686 | ||||||
386 | bool isValid() const { return executed 1380073 times by 25 tests: width >= 0 && height >= 0;return width >= 0 && height >= 0; Executed by:
executed 1380073 times by 25 tests: }return width >= 0 && height >= 0; Executed by:
| 1380073 | ||||||
387 | }; | - | ||||||
388 | - | |||||||
389 | struct Texture { | - | ||||||
390 | uint textureId = 0; | - | ||||||
391 | QSize size; | - | ||||||
392 | - | |||||||
393 | Texture() : size(QSize()) { } executed 2669 times by 146 tests: end of block Executed by:
| 2669 | ||||||
394 | bool operator == (const Texture &other) const { return executed 739 times by 11 tests: textureId == other.textureId;return textureId == other.textureId; Executed by:
executed 739 times by 11 tests: }return textureId == other.textureId; Executed by:
| 739 | ||||||
395 | }; | - | ||||||
396 | - | |||||||
397 | const QRawFont &referenceFont() const { return never executed: m_referenceFont;return m_referenceFont; never executed: }return m_referenceFont; | 0 | ||||||
398 | - | |||||||
399 | qreal fontScale(qreal pixelSize) const | - | ||||||
400 | { | - | ||||||
401 | return executed 1738358 times by 25 tests: pixelSize / QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution);return pixelSize / QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution); Executed by:
executed 1738358 times by 25 tests: return pixelSize / QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution); Executed by:
| 1738358 | ||||||
402 | } | - | ||||||
403 | int distanceFieldRadius() const | - | ||||||
404 | { | - | ||||||
405 | return executed 298708 times by 25 tests: QT_DISTANCEFIELD_RADIUS(m_doubleGlyphResolution) / QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution);return QT_DISTANCEFIELD_RADIUS(m_doubleGlyphResolution) / QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution); Executed by:
executed 298708 times by 25 tests: return QT_DISTANCEFIELD_RADIUS(m_doubleGlyphResolution) / QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution); Executed by:
| 298708 | ||||||
406 | } | - | ||||||
407 | int glyphCount() const { return executed 1380073 times by 25 tests: m_glyphCount;return m_glyphCount; Executed by:
executed 1380073 times by 25 tests: }return m_glyphCount; Executed by:
| 1380073 | ||||||
408 | bool doubleGlyphResolution() const { return never executed: m_doubleGlyphResolution;return m_doubleGlyphResolution; never executed: }return m_doubleGlyphResolution; | 0 | ||||||
409 | - | |||||||
410 | Metrics glyphMetrics(glyph_t glyph, qreal pixelSize); | - | ||||||
411 | inline TexCoord glyphTexCoord(glyph_t glyph); | - | ||||||
412 | inline const Texture *glyphTexture(glyph_t glyph); | - | ||||||
413 | - | |||||||
414 | void populate(const QVector<glyph_t> &glyphs); | - | ||||||
415 | void release(const QVector<glyph_t> &glyphs); | - | ||||||
416 | - | |||||||
417 | void update(); | - | ||||||
418 | - | |||||||
419 | void registerGlyphNode(QSGDistanceFieldGlyphConsumer *node) { m_registeredNodes.insert(node); } executed 249141 times by 25 tests: end of block Executed by:
| 249141 | ||||||
420 | void unregisterGlyphNode(QSGDistanceFieldGlyphConsumer *node) { m_registeredNodes.remove(node); } executed 249141 times by 25 tests: end of block Executed by:
| 249141 | ||||||
421 | - | |||||||
422 | virtual void registerOwnerElement(QQuickItem *ownerElement); | - | ||||||
423 | virtual void unregisterOwnerElement(QQuickItem *ownerElement); | - | ||||||
424 | virtual void processPendingGlyphs(); | - | ||||||
425 | - | |||||||
426 | protected: | - | ||||||
427 | struct GlyphPosition { | - | ||||||
428 | glyph_t glyph; | - | ||||||
429 | QPointF position; | - | ||||||
430 | }; | - | ||||||
431 | - | |||||||
432 | struct GlyphData { | - | ||||||
433 | Texture *texture = nullptr; | - | ||||||
434 | TexCoord texCoord; | - | ||||||
435 | QRectF boundingRect; | - | ||||||
436 | QPainterPath path; | - | ||||||
437 | quint32 ref = 0; | - | ||||||
438 | - | |||||||
439 | GlyphData() {} | - | ||||||
440 | }; | - | ||||||
441 | - | |||||||
442 | virtual void requestGlyphs(const QSet<glyph_t> &glyphs) = 0; | - | ||||||
443 | virtual void storeGlyphs(const QList<QDistanceField> &glyphs) = 0; | - | ||||||
444 | virtual void referenceGlyphs(const QSet<glyph_t> &glyphs) = 0; | - | ||||||
445 | virtual void releaseGlyphs(const QSet<glyph_t> &glyphs) = 0; | - | ||||||
446 | - | |||||||
447 | void setGlyphsPosition(const QList<GlyphPosition> &glyphs); | - | ||||||
448 | void setGlyphsTexture(const QVector<glyph_t> &glyphs, const Texture &tex); | - | ||||||
449 | void markGlyphsToRender(const QVector<glyph_t> &glyphs); | - | ||||||
450 | inline void removeGlyph(glyph_t glyph); | - | ||||||
451 | - | |||||||
452 | void updateTexture(uint oldTex, uint newTex, const QSize &newTexSize); | - | ||||||
453 | - | |||||||
454 | inline bool containsGlyph(glyph_t glyph); | - | ||||||
455 | uint textureIdForGlyph(glyph_t glyph) const; | - | ||||||
456 | - | |||||||
457 | GlyphData &glyphData(glyph_t glyph); | - | ||||||
458 | - | |||||||
459 | - | |||||||
460 | - | |||||||
461 | - | |||||||
462 | - | |||||||
463 | inline bool isCoreProfile() const { return executed 34825 times by 25 tests: m_coreProfile;return m_coreProfile; Executed by:
executed 34825 times by 25 tests: }return m_coreProfile; Executed by:
| 34825 | ||||||
464 | - | |||||||
465 | private: | - | ||||||
466 | QRawFont m_referenceFont; | - | ||||||
467 | int m_glyphCount; | - | ||||||
468 | - | |||||||
469 | bool m_doubleGlyphResolution; | - | ||||||
470 | bool m_coreProfile; | - | ||||||
471 | - | |||||||
472 | QList<Texture> m_textures; | - | ||||||
473 | QHash<glyph_t, GlyphData> m_glyphsData; | - | ||||||
474 | QDataBuffer<glyph_t> m_pendingGlyphs; | - | ||||||
475 | QSet<glyph_t> m_populatingGlyphs; | - | ||||||
476 | QSGDistanceFieldGlyphConsumerList m_registeredNodes; | - | ||||||
477 | - | |||||||
478 | static Texture s_emptyTexture; | - | ||||||
479 | }; | - | ||||||
480 | - | |||||||
481 | inline QSGDistanceFieldGlyphCache::TexCoord QSGDistanceFieldGlyphCache::glyphTexCoord(glyph_t glyph) | - | ||||||
482 | { | - | ||||||
483 | return executed 1360824 times by 25 tests: glyphData(glyph).texCoord;return glyphData(glyph).texCoord; Executed by:
executed 1360824 times by 25 tests: return glyphData(glyph).texCoord; Executed by:
| 1360824 | ||||||
484 | } | - | ||||||
485 | - | |||||||
486 | inline const QSGDistanceFieldGlyphCache::Texture *QSGDistanceFieldGlyphCache::glyphTexture(glyph_t glyph) | - | ||||||
487 | { | - | ||||||
488 | return executed 1248303 times by 25 tests: glyphData(glyph).texture;return glyphData(glyph).texture; Executed by:
executed 1248303 times by 25 tests: return glyphData(glyph).texture; Executed by:
| 1248303 | ||||||
489 | } | - | ||||||
490 | - | |||||||
491 | inline void QSGDistanceFieldGlyphCache::removeGlyph(glyph_t glyph) | - | ||||||
492 | { | - | ||||||
493 | GlyphData &gd = glyphData(glyph); | - | ||||||
494 | gd.texCoord = TexCoord(); | - | ||||||
495 | gd.texture = &s_emptyTexture; | - | ||||||
496 | } never executed: end of block | 0 | ||||||
497 | - | |||||||
498 | inline bool QSGDistanceFieldGlyphCache::containsGlyph(glyph_t glyph) | - | ||||||
499 | { | - | ||||||
500 | return never executed: glyphData(glyph).texCoord.isValid();return glyphData(glyph).texCoord.isValid(); never executed: return glyphData(glyph).texCoord.isValid(); | 0 | ||||||
501 | } | - | ||||||
502 | - | |||||||
503 | - | |||||||
504 | - | |||||||
505 | template <> struct QMetaTypeId< QSGGuiThreadShaderEffectManager::ShaderInfo::Type > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { 0 }; if (const int id = metatype_id.loadAcquire()) return id; const int newId = qRegisterMetaType< QSGGuiThreadShaderEffectManager::ShaderInfo::Type >("QSGGuiThreadShaderEffectManager::ShaderInfo::Type", reinterpret_cast< QSGGuiThreadShaderEffectManager::ShaderInfo::Type *>(quintptr(-1))); metatype_id.storeRelease(newId); return newId; } }; | - | ||||||
Switch to Source code | Preprocessed file |