Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgcontext_p.h |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
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 QSGCONTEXT_H | - |
41 | #define QSGCONTEXT_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 <QtCore/QObject> | - |
55 | #include <QtCore/qabstractanimation.h> | - |
56 | #include <QtCore/QMutex> | - |
57 | - | |
58 | #include <QtGui/QImage> | - |
59 | #include <QtGui/QSurfaceFormat> | - |
60 | - | |
61 | #include <private/qtquickglobal_p.h> | - |
62 | #include <private/qrawfont_p.h> | - |
63 | - | |
64 | #include <QtQuick/qsgnode.h> | - |
65 | - | |
66 | QT_BEGIN_NAMESPACE | - |
67 | - | |
68 | class QSGContextPrivate; | - |
69 | class QSGInternalRectangleNode; | - |
70 | class QSGInternalImageNode; | - |
71 | class QSGPainterNode; | - |
72 | class QSGGlyphNode; | - |
73 | class QSGRenderer; | - |
74 | class QSGDistanceFieldGlyphCache; | - |
75 | class QQuickWindow; | - |
76 | class QSGTexture; | - |
77 | class QSGMaterial; | - |
78 | class QSGRenderLoop; | - |
79 | class QSGLayer; | - |
80 | class QQuickTextureFactory; | - |
81 | class QSGCompressedTextureFactory; | - |
82 | class QSGContext; | - |
83 | class QQuickPaintedItem; | - |
84 | class QSGRendererInterface; | - |
85 | class QSGShaderEffectNode; | - |
86 | class QSGGuiThreadShaderEffectManager; | - |
87 | class QSGRectangleNode; | - |
88 | class QSGImageNode; | - |
89 | class QSGNinePatchNode; | - |
90 | class QSGSpriteNode; | - |
91 | class QSGRenderContext; | - |
92 | - | |
93 | Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_RENDERLOOP) | - |
94 | Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_COMPILATION) | - |
95 | Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_TEXTURE) | - |
96 | Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_GLYPH) | - |
97 | Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_RENDERER) | - |
98 | - | |
99 | Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_INFO) | - |
100 | Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_RENDERLOOP) | - |
101 | - | |
102 | class Q_QUICK_PRIVATE_EXPORT QSGContext : public QObject | - |
103 | { | - |
104 | Q_OBJECT | - |
105 | - | |
106 | public: | - |
107 | enum AntialiasingMethod { | - |
108 | UndecidedAntialiasing, | - |
109 | VertexAntialiasing, | - |
110 | MsaaAntialiasing | - |
111 | }; | - |
112 | - | |
113 | explicit QSGContext(QObject *parent = nullptr); | - |
114 | ~QSGContext() override; | - |
115 | - | |
116 | virtual void renderContextInitialized(QSGRenderContext *renderContext); | - |
117 | virtual void renderContextInvalidated(QSGRenderContext *renderContext); | - |
118 | virtual QSGRenderContext *createRenderContext() = 0; | - |
119 | - | |
120 | QSGInternalRectangleNode *createInternalRectangleNode(const QRectF &rect, const QColor &c); | - |
121 | virtual QSGInternalRectangleNode *createInternalRectangleNode() = 0; | - |
122 | virtual QSGInternalImageNode *createInternalImageNode() = 0; | - |
123 | virtual QSGPainterNode *createPainterNode(QQuickPaintedItem *item) = 0; | - |
124 | virtual QSGGlyphNode *createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) = 0; | - |
125 | virtual QSGLayer *createLayer(QSGRenderContext *renderContext) = 0; | - |
126 | virtual QSGGuiThreadShaderEffectManager *createGuiThreadShaderEffectManager(); | - |
127 | virtual QSGShaderEffectNode *createShaderEffectNode(QSGRenderContext *renderContext, | - |
128 | QSGGuiThreadShaderEffectManager *mgr); | - |
129 | #if QT_CONFIG(quick_sprite) | - |
130 | virtual QSGSpriteNode *createSpriteNode() = 0; | - |
131 | #endif | - |
132 | virtual QAnimationDriver *createAnimationDriver(QObject *parent); | - |
133 | - | |
134 | virtual QSize minimumFBOSize() const; | - |
135 | virtual QSurfaceFormat defaultSurfaceFormat() const = 0; | - |
136 | - | |
137 | virtual QSGRendererInterface *rendererInterface(QSGRenderContext *renderContext); | - |
138 | - | |
139 | virtual QSGRectangleNode *createRectangleNode() = 0; | - |
140 | virtual QSGImageNode *createImageNode() = 0; | - |
141 | virtual QSGNinePatchNode *createNinePatchNode() = 0; | - |
142 | - | |
143 | static QSGContext *createDefaultContext(); | - |
144 | static QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image); | - |
145 | static QSGRenderLoop *createWindowManager(); | - |
146 | - | |
147 | static void setBackend(const QString &backend); | - |
148 | static QString backend(); | - |
149 | }; | - |
150 | - | |
151 | class Q_QUICK_PRIVATE_EXPORT QSGRenderContext : public QObject | - |
152 | { | - |
153 | Q_OBJECT | - |
154 | public: | - |
155 | enum CreateTextureFlags { | - |
156 | CreateTexture_Alpha = 0x1, | - |
157 | CreateTexture_Atlas = 0x2, | - |
158 | CreateTexture_Mipmap = 0x4 | - |
159 | }; | - |
160 | - | |
161 | QSGRenderContext(QSGContext *context); | - |
162 | ~QSGRenderContext() override; | - |
163 | - | |
164 | QSGContext *sceneGraphContext() const { return m_sg; } executed 330989 times by 74 tests: return m_sg; Executed by:
| 330989 |
165 | virtual bool isValid() const { return true; } executed 8 times by 1 test: return true; Executed by:
| 8 |
166 | - | |
167 | virtual void initialize(void *context); | - |
168 | virtual void invalidate(); | - |
169 | virtual void renderNextFrame(QSGRenderer *renderer, uint fboId) = 0; | - |
170 | virtual void endSync(); | - |
171 | - | |
172 | virtual QSGDistanceFieldGlyphCache *distanceFieldGlyphCache(const QRawFont &font); | - |
173 | QSGTexture *textureForFactory(QQuickTextureFactory *factory, QQuickWindow *window); | - |
174 | - | |
175 | virtual QSGTexture *createTexture(const QImage &image, uint flags = CreateTexture_Alpha) const = 0; | - |
176 | virtual QSGRenderer *createRenderer() = 0; | - |
177 | virtual QSGTexture *compressedTextureForFactory(const QSGCompressedTextureFactory *) const; | - |
178 | - | |
179 | virtual void setAttachToGraphicsContext(bool attach) { Q_UNUSED(attach); } never executed: end of block | 0 |
180 | - | |
181 | virtual int maxTextureSize() const = 0; | - |
182 | - | |
183 | void registerFontengineForCleanup(QFontEngine *engine); | - |
184 | - | |
185 | Q_SIGNALS: | - |
186 | void initialized(); | - |
187 | void invalidated(); | - |
188 | - | |
189 | public Q_SLOTS: | - |
190 | void textureFactoryDestroyed(QObject *o); | - |
191 | - | |
192 | protected: | - |
193 | // Hold m_sg with QPointer in the rare case it gets deleted before us. | - |
194 | QPointer<QSGContext> m_sg; | - |
195 | - | |
196 | QMutex m_mutex; | - |
197 | QHash<QQuickTextureFactory *, QSGTexture *> m_textures; | - |
198 | QSet<QSGTexture *> m_texturesToDelete; | - |
199 | QHash<QString, QSGDistanceFieldGlyphCache *> m_glyphCaches; | - |
200 | - | |
201 | QSet<QFontEngine *> m_fontEnginesToClean; | - |
202 | }; | - |
203 | - | |
204 | QT_END_NAMESPACE | - |
205 | - | |
206 | #endif // QSGCONTEXT_H | - |
Source code | Switch to Preprocessed file |