OpenCoverage

qsgdefaultdistancefieldglyphcache_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QSGDEFAULTDISTANCEFIELDGLYPHCACHE_H-
41#define QSGDEFAULTDISTANCEFIELDGLYPHCACHE_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include "qsgadaptationlayer_p.h"-
55#include <QtGui/qopenglfunctions.h>-
56#include <qopenglshaderprogram.h>-
57#include <qopenglbuffer.h>-
58#include <qopenglvertexarrayobject.h>-
59#include <QtGui/private/qopenglengineshadersource_p.h>-
60#include <private/qsgareaallocator_p.h>-
61-
62QT_BEGIN_NAMESPACE-
63-
64class QOpenGLSharedResourceGuard;-
65#if !defined(QT_OPENGL_ES_2)-
66class QOpenGLFunctions_3_2_Core;-
67#endif-
68-
69class Q_QUICK_PRIVATE_EXPORT QSGDefaultDistanceFieldGlyphCache : public QSGDistanceFieldGlyphCache-
70{-
71public:-
72 QSGDefaultDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font);-
73 virtual ~QSGDefaultDistanceFieldGlyphCache();-
74-
75 void requestGlyphs(const QSet<glyph_t> &glyphs) override;-
76 void storeGlyphs(const QList<QDistanceField> &glyphs) override;-
77 void referenceGlyphs(const QSet<glyph_t> &glyphs) override;-
78 void releaseGlyphs(const QSet<glyph_t> &glyphs) override;-
79-
80 bool useTextureResizeWorkaround() const;-
81 bool useTextureUploadWorkaround() const;-
82 bool createFullSizeTextures() const;-
83 int maxTextureSize() const;-
84-
85 void setMaxTextureCount(int max) { m_maxTextureCount = max; }
never executed: end of block
0
86 int maxTextureCount() const { return m_maxTextureCount; }
never executed: return m_maxTextureCount;
0
87-
88private:-
89 struct TextureInfo {-
90 GLuint texture;-
91 QSize size;-
92 QRect allocatedArea;-
93 QDistanceField image;-
94 int padding = -1;-
95-
96 TextureInfo(const QRect &preallocRect = QRect()) : texture(0), allocatedArea(preallocRect) { }
executed 1620 times by 24 tests: end of block
Executed by:
  • tst_examples
  • tst_flickableinterop
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpincharea
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquicktaphandler
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_qquicktextinput
  • tst_scenegraph
  • tst_touchmouse
1620
97 };-
98-
99 void createTexture(TextureInfo * texInfo, int width, int height);-
100 void resizeTexture(TextureInfo * texInfo, int width, int height);-
101-
102 TextureInfo *textureInfo(int index)-
103 {-
104 for (int i = m_textures.count(); i <= index; ++i) {
i <= indexDescription
TRUEevaluated 1620 times by 24 tests
Evaluated by:
  • tst_examples
  • tst_flickableinterop
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpincharea
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquicktaphandler
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_qquicktextinput
  • tst_scenegraph
  • tst_touchmouse
FALSEevaluated 28812 times by 24 tests
Evaluated by:
  • tst_examples
  • tst_flickableinterop
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpincharea
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquicktaphandler
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_qquicktextinput
  • tst_scenegraph
  • tst_touchmouse
1620-28812
105 if (createFullSizeTextures())
createFullSizeTextures()Description
TRUEnever evaluated
FALSEevaluated 1620 times by 24 tests
Evaluated by:
  • tst_examples
  • tst_flickableinterop
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpincharea
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquicktaphandler
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_qquicktextinput
  • tst_scenegraph
  • tst_touchmouse
0-1620
106 m_textures.append(QRect(0, 0, maxTextureSize(), maxTextureSize()));
never executed: m_textures.append(QRect(0, 0, maxTextureSize(), maxTextureSize()));
0
107 else-
108 m_textures.append(TextureInfo());
executed 1620 times by 24 tests: m_textures.append(TextureInfo());
Executed by:
  • tst_examples
  • tst_flickableinterop
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpincharea
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquicktaphandler
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_qquicktextinput
  • tst_scenegraph
  • tst_touchmouse
1620
109 }-
110-
111 return &m_textures[index];
executed 28812 times by 24 tests: return &m_textures[index];
Executed by:
  • tst_examples
  • tst_flickableinterop
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpincharea
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquicktaphandler
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_qquicktextinput
  • tst_scenegraph
  • tst_touchmouse
28812
112 }-
113-
114 void createBlitProgram()-
115 {-
116 m_blitProgram = new QOpenGLShaderProgram;-
117 {-
118 const QString source = QLatin1String(qopenglslMainWithTexCoordsVertexShader)-
119 + QLatin1String(qopenglslUntransformedPositionVertexShader);-
120-
121 m_blitProgram->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, source);-
122 }-
123 {-
124 const QString source = QLatin1String(qopenglslMainFragmentShader)-
125 + QLatin1String(qopenglslImageSrcFragmentShader);-
126-
127 m_blitProgram->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, source);-
128 }-
129 m_blitProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);-
130 m_blitProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);-
131 m_blitProgram->link();-
132 }
executed 453 times by 11 tests: end of block
Executed by:
  • tst_flickableinterop
  • tst_qquickdraghandler
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_qquicktextinput
453
133-
134 mutable int m_maxTextureSize;-
135 int m_maxTextureCount;-
136-
137 QList<TextureInfo> m_textures;-
138 QHash<glyph_t, TextureInfo *> m_glyphsTexture;-
139 QSet<glyph_t> m_unusedGlyphs;-
140-
141 QSGAreaAllocator *m_areaAllocator;-
142-
143 QOpenGLShaderProgram *m_blitProgram;-
144 QOpenGLBuffer m_blitBuffer;-
145 QOpenGLVertexArrayObject m_vao;-
146-
147 QOpenGLSharedResourceGuard *m_fboGuard;-
148 QOpenGLFunctions *m_funcs;-
149#if !defined(QT_OPENGL_ES_2)-
150 QOpenGLFunctions_3_2_Core *m_coreFuncs;-
151#endif-
152};-
153-
154QT_END_NAMESPACE-
155-
156#endif // QSGDEFAULTDISTANCEFIELDGLYPHCACHE_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0