Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgdefaultcontext.cpp |
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 | #include "qsgdefaultcontext_p.h" | - | ||||||||||||||||||||||||
41 | - | |||||||||||||||||||||||||
42 | #include <QtQuick/private/qsgdefaultinternalrectanglenode_p.h> | - | ||||||||||||||||||||||||
43 | #include <QtQuick/private/qsgdefaultinternalimagenode_p.h> | - | ||||||||||||||||||||||||
44 | #include <QtQuick/private/qsgdefaultpainternode_p.h> | - | ||||||||||||||||||||||||
45 | #include <QtQuick/private/qsgdefaultglyphnode_p.h> | - | ||||||||||||||||||||||||
46 | #include <QtQuick/private/qsgdistancefieldglyphnode_p.h> | - | ||||||||||||||||||||||||
47 | #include <QtQuick/private/qsgdistancefieldglyphnode_p_p.h> | - | ||||||||||||||||||||||||
48 | #include <QtQuick/private/qsgrenderloop_p.h> | - | ||||||||||||||||||||||||
49 | #include <QtQuick/private/qsgdefaultlayer_p.h> | - | ||||||||||||||||||||||||
50 | #include <QtQuick/private/qsgdefaultrendercontext_p.h> | - | ||||||||||||||||||||||||
51 | #include <QtQuick/private/qsgdefaultrectanglenode_p.h> | - | ||||||||||||||||||||||||
52 | #include <QtQuick/private/qsgdefaultimagenode_p.h> | - | ||||||||||||||||||||||||
53 | #include <QtQuick/private/qsgdefaultninepatchnode_p.h> | - | ||||||||||||||||||||||||
54 | #if QT_CONFIG(quick_sprite) | - | ||||||||||||||||||||||||
55 | #include <QtQuick/private/qsgdefaultspritenode_p.h> | - | ||||||||||||||||||||||||
56 | #endif | - | ||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||
58 | #include <QtGui/QOpenGLContext> | - | ||||||||||||||||||||||||
59 | #include <QtGui/QOpenGLFramebufferObject> | - | ||||||||||||||||||||||||
60 | - | |||||||||||||||||||||||||
61 | #include <QtQuick/QQuickWindow> | - | ||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||
63 | #include <private/qqmlglobal_p.h> | - | ||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||
65 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | namespace QSGMultisampleAntialiasing { | - | ||||||||||||||||||||||||
68 | class ImageNode : public QSGDefaultInternalImageNode { | - | ||||||||||||||||||||||||
69 | public: | - | ||||||||||||||||||||||||
70 | void setAntialiasing(bool) override { } | - | ||||||||||||||||||||||||
71 | }; | - | ||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||
74 | class RectangleNode : public QSGDefaultInternalRectangleNode { | - | ||||||||||||||||||||||||
75 | public: | - | ||||||||||||||||||||||||
76 | void setAntialiasing(bool) override { } | - | ||||||||||||||||||||||||
77 | }; | - | ||||||||||||||||||||||||
78 | } | - | ||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD) never executed: status = Yes; never executed: end of block executed 194 times by 90 tests: end of block Executed by:
executed 200 times by 90 tests: return status == Yes; Executed by:
| 0-200 | ||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | QSGDefaultContext::QSGDefaultContext(QObject *parent) | - | ||||||||||||||||||||||||
83 | : QSGContext (parent) | - | ||||||||||||||||||||||||
84 | , m_antialiasingMethod(QSGContext::UndecidedAntialiasing) | - | ||||||||||||||||||||||||
85 | , m_distanceFieldDisabled(qmlDisableDistanceField()) | - | ||||||||||||||||||||||||
86 | , m_distanceFieldAntialiasing(QSGGlyphNode::HighQualitySubPixelAntialiasing) | - | ||||||||||||||||||||||||
87 | , m_distanceFieldAntialiasingDecided(false) | - | ||||||||||||||||||||||||
88 | { | - | ||||||||||||||||||||||||
89 | if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QSG_DISTANCEFIELD_ANTIALIASING"))) {
| 0-200 | ||||||||||||||||||||||||
90 | const QByteArray mode = qgetenv("QSG_DISTANCEFIELD_ANTIALIASING"); | - | ||||||||||||||||||||||||
91 | m_distanceFieldAntialiasingDecided = true; | - | ||||||||||||||||||||||||
92 | if (mode == "subpixel")
| 0 | ||||||||||||||||||||||||
93 | m_distanceFieldAntialiasing = QSGGlyphNode::HighQualitySubPixelAntialiasing; never executed: m_distanceFieldAntialiasing = QSGGlyphNode::HighQualitySubPixelAntialiasing; | 0 | ||||||||||||||||||||||||
94 | else if (mode == "subpixel-lowq")
| 0 | ||||||||||||||||||||||||
95 | m_distanceFieldAntialiasing = QSGGlyphNode::LowQualitySubPixelAntialiasing; never executed: m_distanceFieldAntialiasing = QSGGlyphNode::LowQualitySubPixelAntialiasing; | 0 | ||||||||||||||||||||||||
96 | else if (mode == "gray")
| 0 | ||||||||||||||||||||||||
97 | m_distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing; never executed: m_distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing; | 0 | ||||||||||||||||||||||||
98 | } never executed: end of block | 0 | ||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | // Adds compatibility with Qt 5.3 and earlier's QSG_RENDER_TIMING | - | ||||||||||||||||||||||||
101 | if (qEnvironmentVariableIsSet("QSG_RENDER_TIMING")) {
| 0-200 | ||||||||||||||||||||||||
102 | const_cast<QLoggingCategory &>(QSG_LOG_TIME_GLYPH()).setEnabled(QtDebugMsg, true); | - | ||||||||||||||||||||||||
103 | const_cast<QLoggingCategory &>(QSG_LOG_TIME_TEXTURE()).setEnabled(QtDebugMsg, true); | - | ||||||||||||||||||||||||
104 | const_cast<QLoggingCategory &>(QSG_LOG_TIME_RENDERER()).setEnabled(QtDebugMsg, true); | - | ||||||||||||||||||||||||
105 | const_cast<QLoggingCategory &>(QSG_LOG_TIME_RENDERLOOP()).setEnabled(QtDebugMsg, true); | - | ||||||||||||||||||||||||
106 | const_cast<QLoggingCategory &>(QSG_LOG_TIME_COMPILATION()).setEnabled(QtDebugMsg, true); | - | ||||||||||||||||||||||||
107 | } never executed: end of block | 0 | ||||||||||||||||||||||||
108 | } executed 200 times by 90 tests: end of block Executed by:
| 200 | ||||||||||||||||||||||||
109 | - | |||||||||||||||||||||||||
110 | QSGDefaultContext::~QSGDefaultContext() | - | ||||||||||||||||||||||||
111 | { | - | ||||||||||||||||||||||||
112 | - | |||||||||||||||||||||||||
113 | } | - | ||||||||||||||||||||||||
114 | - | |||||||||||||||||||||||||
115 | void QSGDefaultContext::renderContextInitialized(QSGRenderContext *renderContext) | - | ||||||||||||||||||||||||
116 | { | - | ||||||||||||||||||||||||
117 | m_mutex.lock(); | - | ||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||
119 | auto openglRenderContext = static_cast<const QSGDefaultRenderContext *>(renderContext); | - | ||||||||||||||||||||||||
120 | if (m_antialiasingMethod == UndecidedAntialiasing) {
| 158-2966 | ||||||||||||||||||||||||
121 | if (Q_UNLIKELY(qEnvironmentVariableIsSet("QSG_ANTIALIASING_METHOD"))) {
| 0-158 | ||||||||||||||||||||||||
122 | const QByteArray aaType = qgetenv("QSG_ANTIALIASING_METHOD"); | - | ||||||||||||||||||||||||
123 | if (aaType == "msaa")
| 0 | ||||||||||||||||||||||||
124 | m_antialiasingMethod = MsaaAntialiasing; never executed: m_antialiasingMethod = MsaaAntialiasing; | 0 | ||||||||||||||||||||||||
125 | else if (aaType == "vertex")
| 0 | ||||||||||||||||||||||||
126 | m_antialiasingMethod = VertexAntialiasing; never executed: m_antialiasingMethod = VertexAntialiasing; | 0 | ||||||||||||||||||||||||
127 | } never executed: end of block | 0 | ||||||||||||||||||||||||
128 | if (m_antialiasingMethod == UndecidedAntialiasing) {
| 0-158 | ||||||||||||||||||||||||
129 | if (openglRenderContext->openglContext()->format().samples() > 0)
| 0-158 | ||||||||||||||||||||||||
130 | m_antialiasingMethod = MsaaAntialiasing; never executed: m_antialiasingMethod = MsaaAntialiasing; | 0 | ||||||||||||||||||||||||
131 | else | - | ||||||||||||||||||||||||
132 | m_antialiasingMethod = VertexAntialiasing; executed 158 times by 76 tests: m_antialiasingMethod = VertexAntialiasing; Executed by:
| 158 | ||||||||||||||||||||||||
133 | } | - | ||||||||||||||||||||||||
134 | } executed 158 times by 76 tests: end of block Executed by:
| 158 | ||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||
136 | // With OpenGL ES, except for Angle on Windows, use GrayAntialiasing, unless | - | ||||||||||||||||||||||||
137 | // some value had been requested explicitly. This could not be decided | - | ||||||||||||||||||||||||
138 | // before without a context. Now the context is ready. | - | ||||||||||||||||||||||||
139 | if (!m_distanceFieldAntialiasingDecided) {
| 158-2966 | ||||||||||||||||||||||||
140 | m_distanceFieldAntialiasingDecided = true; | - | ||||||||||||||||||||||||
141 | #ifndef Q_OS_WIN32 | - | ||||||||||||||||||||||||
142 | if (openglRenderContext->openglContext()->isOpenGLES())
| 0-158 | ||||||||||||||||||||||||
143 | m_distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing; never executed: m_distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing; | 0 | ||||||||||||||||||||||||
144 | #endif | - | ||||||||||||||||||||||||
145 | } executed 158 times by 76 tests: end of block Executed by:
| 158 | ||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||
147 | static bool dumped = false; | - | ||||||||||||||||||||||||
148 | if (!dumped && QSG_LOG_INFO().isDebugEnabled()) {
| 0-3124 | ||||||||||||||||||||||||
149 | dumped = true; | - | ||||||||||||||||||||||||
150 | QSurfaceFormat format = openglRenderContext->openglContext()->format(); | - | ||||||||||||||||||||||||
151 | QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); | - | ||||||||||||||||||||||||
152 | qCDebug(QSG_LOG_INFO, "R/G/B/A Buffers: %d %d %d %d", format.redBufferSize(), never executed: QMessageLogger( __FILE__ , 153 , __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("R/G/B/A Buffers: %d %d %d %d", format.redBufferSize(), format.greenBufferSize(), format.blueBufferSize(), format.alphaBufferSize()) ;
| 0 | ||||||||||||||||||||||||
153 | format.greenBufferSize(), format.blueBufferSize(), format.alphaBufferSize()); never executed: QMessageLogger( __FILE__ , 153 , __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("R/G/B/A Buffers: %d %d %d %d", format.redBufferSize(), format.greenBufferSize(), format.blueBufferSize(), format.alphaBufferSize()) ; | 0 | ||||||||||||||||||||||||
154 | qCDebug(QSG_LOG_INFO, "Depth Buffer: %d", format.depthBufferSize()); never executed: QMessageLogger(__FILE__, 154, __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("Depth Buffer: %d", format.depthBufferSize());
| 0 | ||||||||||||||||||||||||
155 | qCDebug(QSG_LOG_INFO, "Stencil Buffer: %d", format.stencilBufferSize()); never executed: QMessageLogger(__FILE__, 155, __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("Stencil Buffer: %d", format.stencilBufferSize());
| 0 | ||||||||||||||||||||||||
156 | qCDebug(QSG_LOG_INFO, "Samples: %d", format.samples()); never executed: QMessageLogger(__FILE__, 156, __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("Samples: %d", format.samples());
| 0 | ||||||||||||||||||||||||
157 | qCDebug(QSG_LOG_INFO, "GL_VENDOR: %s", (const char*)funcs->glGetString(GL_VENDOR)); never executed: QMessageLogger(__FILE__, 157, __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("GL_VENDOR: %s", (const char*)funcs->glGetString( 0x1F00 ));
| 0 | ||||||||||||||||||||||||
158 | qCDebug(QSG_LOG_INFO, "GL_RENDERER: %s", never executed: QMessageLogger( __FILE__ , 159 , __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("GL_RENDERER: %s", (const char*)funcs->glGetString( 0x1F01 )) ;
| 0 | ||||||||||||||||||||||||
159 | (const char*)funcs->glGetString(GL_RENDERER)); never executed: QMessageLogger( __FILE__ , 159 , __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("GL_RENDERER: %s", (const char*)funcs->glGetString( 0x1F01 )) ; | 0 | ||||||||||||||||||||||||
160 | qCDebug(QSG_LOG_INFO, "GL_VERSION: %s", (const char*)funcs->glGetString(GL_VERSION)); never executed: QMessageLogger(__FILE__, 160, __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("GL_VERSION: %s", (const char*)funcs->glGetString( 0x1F02 ));
| 0 | ||||||||||||||||||||||||
161 | QSet<QByteArray> exts = openglRenderContext->openglContext()->extensions(); | - | ||||||||||||||||||||||||
162 | QByteArray all; | - | ||||||||||||||||||||||||
163 | for (const QByteArray &e : qAsConst(exts)) | - | ||||||||||||||||||||||||
164 | all += ' ' + e; never executed: all += ' ' + e; | 0 | ||||||||||||||||||||||||
165 | qCDebug(QSG_LOG_INFO, "GL_EXTENSIONS: %s", all.constData()); never executed: QMessageLogger(__FILE__, 165, __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("GL_EXTENSIONS: %s", all.constData());
| 0 | ||||||||||||||||||||||||
166 | qCDebug(QSG_LOG_INFO, "Max Texture Size: %d", openglRenderContext->maxTextureSize()); never executed: QMessageLogger(__FILE__, 166, __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("Max Texture Size: %d", openglRenderContext->maxTextureSize());
| 0 | ||||||||||||||||||||||||
167 | qCDebug(QSG_LOG_INFO, "Debug context: %s", never executed: QMessageLogger( __FILE__ , 168 , __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("Debug context: %s", format.testOption(QSurfaceFormat::DebugContext) ? "true" : "false") ;
| 0 | ||||||||||||||||||||||||
168 | format.testOption(QSurfaceFormat::DebugContext) ? "true" : "false"); never executed: QMessageLogger( __FILE__ , 168 , __PRETTY_FUNCTION__, QSG_LOG_INFO().categoryName()).debug("Debug context: %s", format.testOption(QSurfaceFormat::DebugContext) ? "true" : "false") ; | 0 | ||||||||||||||||||||||||
169 | } never executed: end of block | 0 | ||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||
171 | m_mutex.unlock(); | - | ||||||||||||||||||||||||
172 | } executed 3124 times by 76 tests: end of block Executed by:
| 3124 | ||||||||||||||||||||||||
173 | - | |||||||||||||||||||||||||
174 | void QSGDefaultContext::renderContextInvalidated(QSGRenderContext *) | - | ||||||||||||||||||||||||
175 | { | - | ||||||||||||||||||||||||
176 | } | - | ||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | QSGRenderContext *QSGDefaultContext::createRenderContext() | - | ||||||||||||||||||||||||
179 | { | - | ||||||||||||||||||||||||
180 | return new QSGDefaultRenderContext(this); executed 314 times by 90 tests: return new QSGDefaultRenderContext(this); Executed by:
| 314 | ||||||||||||||||||||||||
181 | } | - | ||||||||||||||||||||||||
182 | - | |||||||||||||||||||||||||
183 | QSGInternalRectangleNode *QSGDefaultContext::createInternalRectangleNode() | - | ||||||||||||||||||||||||
184 | { | - | ||||||||||||||||||||||||
185 | return m_antialiasingMethod == MsaaAntialiasing executed 72061 times by 66 tests: return m_antialiasingMethod == MsaaAntialiasing ? new QSGMultisampleAntialiasing::RectangleNode : new QSGDefaultInternalRectangleNode; Executed by:
| 72061 | ||||||||||||||||||||||||
186 | ? new QSGMultisampleAntialiasing::RectangleNode executed 72061 times by 66 tests: return m_antialiasingMethod == MsaaAntialiasing ? new QSGMultisampleAntialiasing::RectangleNode : new QSGDefaultInternalRectangleNode; Executed by:
| 72061 | ||||||||||||||||||||||||
187 | : new QSGDefaultInternalRectangleNode; executed 72061 times by 66 tests: return m_antialiasingMethod == MsaaAntialiasing ? new QSGMultisampleAntialiasing::RectangleNode : new QSGDefaultInternalRectangleNode; Executed by:
| 72061 | ||||||||||||||||||||||||
188 | } | - | ||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||
190 | QSGInternalImageNode *QSGDefaultContext::createInternalImageNode() | - | ||||||||||||||||||||||||
191 | { | - | ||||||||||||||||||||||||
192 | return m_antialiasingMethod == MsaaAntialiasing executed 5189 times by 10 tests: return m_antialiasingMethod == MsaaAntialiasing ? new QSGMultisampleAntialiasing::ImageNode : new QSGDefaultInternalImageNode; Executed by:
| 5189 | ||||||||||||||||||||||||
193 | ? new QSGMultisampleAntialiasing::ImageNode executed 5189 times by 10 tests: return m_antialiasingMethod == MsaaAntialiasing ? new QSGMultisampleAntialiasing::ImageNode : new QSGDefaultInternalImageNode; Executed by:
| 5189 | ||||||||||||||||||||||||
194 | : new QSGDefaultInternalImageNode; executed 5189 times by 10 tests: return m_antialiasingMethod == MsaaAntialiasing ? new QSGMultisampleAntialiasing::ImageNode : new QSGDefaultInternalImageNode; Executed by:
| 5189 | ||||||||||||||||||||||||
195 | } | - | ||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||
197 | QSGPainterNode *QSGDefaultContext::createPainterNode(QQuickPaintedItem *item) | - | ||||||||||||||||||||||||
198 | { | - | ||||||||||||||||||||||||
199 | return new QSGDefaultPainterNode(item); executed 16 times by 1 test: return new QSGDefaultPainterNode(item); Executed by:
| 16 | ||||||||||||||||||||||||
200 | } | - | ||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||
202 | QSGGlyphNode *QSGDefaultContext::createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) | - | ||||||||||||||||||||||||
203 | { | - | ||||||||||||||||||||||||
204 | if (m_distanceFieldDisabled || preferNativeGlyphNode) {
| 0-249203 | ||||||||||||||||||||||||
205 | return new QSGDefaultGlyphNode; executed 72 times by 1 test: return new QSGDefaultGlyphNode; Executed by:
| 72 | ||||||||||||||||||||||||
206 | } else { | - | ||||||||||||||||||||||||
207 | QSGDistanceFieldGlyphNode *node = new QSGDistanceFieldGlyphNode(rc); | - | ||||||||||||||||||||||||
208 | node->setPreferredAntialiasingMode(m_distanceFieldAntialiasing); | - | ||||||||||||||||||||||||
209 | return node; executed 249131 times by 24 tests: return node; Executed by:
| 249131 | ||||||||||||||||||||||||
210 | } | - | ||||||||||||||||||||||||
211 | } | - | ||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||
213 | QSGLayer *QSGDefaultContext::createLayer(QSGRenderContext *renderContext) | - | ||||||||||||||||||||||||
214 | { | - | ||||||||||||||||||||||||
215 | return new QSGDefaultLayer(renderContext); executed 109 times by 6 tests: return new QSGDefaultLayer(renderContext); Executed by:
| 109 | ||||||||||||||||||||||||
216 | } | - | ||||||||||||||||||||||||
217 | - | |||||||||||||||||||||||||
218 | QSurfaceFormat QSGDefaultContext::defaultSurfaceFormat() const | - | ||||||||||||||||||||||||
219 | { | - | ||||||||||||||||||||||||
220 | QSurfaceFormat format = QSurfaceFormat::defaultFormat(); | - | ||||||||||||||||||||||||
221 | static bool useDepth = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER"); | - | ||||||||||||||||||||||||
222 | static bool useStencil = qEnvironmentVariableIsEmpty("QSG_NO_STENCIL_BUFFER"); | - | ||||||||||||||||||||||||
223 | static bool enableDebug = qEnvironmentVariableIsSet("QSG_OPENGL_DEBUG"); | - | ||||||||||||||||||||||||
224 | format.setDepthBufferSize(useDepth ? 24 : 0); | - | ||||||||||||||||||||||||
225 | format.setStencilBufferSize(useStencil ? 8 : 0); | - | ||||||||||||||||||||||||
226 | if (enableDebug)
| 0-8480 | ||||||||||||||||||||||||
227 | format.setOption(QSurfaceFormat::DebugContext); never executed: format.setOption(QSurfaceFormat::DebugContext); | 0 | ||||||||||||||||||||||||
228 | if (QQuickWindow::hasDefaultAlphaBuffer())
| 0-8480 | ||||||||||||||||||||||||
229 | format.setAlphaBufferSize(8); never executed: format.setAlphaBufferSize(8); | 0 | ||||||||||||||||||||||||
230 | format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); | - | ||||||||||||||||||||||||
231 | return format; executed 8480 times by 90 tests: return format; Executed by:
| 8480 | ||||||||||||||||||||||||
232 | } | - | ||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||
234 | void QSGDefaultContext::setDistanceFieldEnabled(bool enabled) | - | ||||||||||||||||||||||||
235 | { | - | ||||||||||||||||||||||||
236 | m_distanceFieldDisabled = !enabled; | - | ||||||||||||||||||||||||
237 | } never executed: end of block | 0 | ||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||
239 | bool QSGDefaultContext::isDistanceFieldEnabled() const | - | ||||||||||||||||||||||||
240 | { | - | ||||||||||||||||||||||||
241 | return !m_distanceFieldDisabled; never executed: return !m_distanceFieldDisabled; | 0 | ||||||||||||||||||||||||
242 | } | - | ||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||
244 | QSGRendererInterface *QSGDefaultContext::rendererInterface(QSGRenderContext *renderContext) | - | ||||||||||||||||||||||||
245 | { | - | ||||||||||||||||||||||||
246 | Q_UNUSED(renderContext); | - | ||||||||||||||||||||||||
247 | return this; executed 4072 times by 31 tests: return this; Executed by:
| 4072 | ||||||||||||||||||||||||
248 | } | - | ||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | QSGRectangleNode *QSGDefaultContext::createRectangleNode() | - | ||||||||||||||||||||||||
251 | { | - | ||||||||||||||||||||||||
252 | return new QSGDefaultRectangleNode; never executed: return new QSGDefaultRectangleNode; | 0 | ||||||||||||||||||||||||
253 | } | - | ||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||
255 | QSGImageNode *QSGDefaultContext::createImageNode() | - | ||||||||||||||||||||||||
256 | { | - | ||||||||||||||||||||||||
257 | return new QSGDefaultImageNode; never executed: return new QSGDefaultImageNode; | 0 | ||||||||||||||||||||||||
258 | } | - | ||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||
260 | QSGNinePatchNode *QSGDefaultContext::createNinePatchNode() | - | ||||||||||||||||||||||||
261 | { | - | ||||||||||||||||||||||||
262 | return new QSGDefaultNinePatchNode; never executed: return new QSGDefaultNinePatchNode; | 0 | ||||||||||||||||||||||||
263 | } | - | ||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | #if QT_CONFIG(quick_sprite) | - | ||||||||||||||||||||||||
266 | QSGSpriteNode *QSGDefaultContext::createSpriteNode() | - | ||||||||||||||||||||||||
267 | { | - | ||||||||||||||||||||||||
268 | return new QSGDefaultSpriteNode; executed 30 times by 2 tests: return new QSGDefaultSpriteNode; Executed by:
| 30 | ||||||||||||||||||||||||
269 | } | - | ||||||||||||||||||||||||
270 | #endif | - | ||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||
272 | QSGRendererInterface::GraphicsApi QSGDefaultContext::graphicsApi() const | - | ||||||||||||||||||||||||
273 | { | - | ||||||||||||||||||||||||
274 | return OpenGL; executed 4072 times by 31 tests: return OpenGL; Executed by:
| 4072 | ||||||||||||||||||||||||
275 | } | - | ||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | QSGRendererInterface::ShaderType QSGDefaultContext::shaderType() const | - | ||||||||||||||||||||||||
278 | { | - | ||||||||||||||||||||||||
279 | return GLSL; executed 2 times by 1 test: return GLSL; Executed by:
| 2 | ||||||||||||||||||||||||
280 | } | - | ||||||||||||||||||||||||
281 | - | |||||||||||||||||||||||||
282 | QSGRendererInterface::ShaderCompilationTypes QSGDefaultContext::shaderCompilationType() const | - | ||||||||||||||||||||||||
283 | { | - | ||||||||||||||||||||||||
284 | return RuntimeCompilation; executed 2 times by 1 test: return RuntimeCompilation; Executed by:
| 2 | ||||||||||||||||||||||||
285 | } | - | ||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||
287 | QSGRendererInterface::ShaderSourceTypes QSGDefaultContext::shaderSourceType() const | - | ||||||||||||||||||||||||
288 | { | - | ||||||||||||||||||||||||
289 | return ShaderSourceString | ShaderSourceFile; executed 2 times by 1 test: return ShaderSourceString | ShaderSourceFile; Executed by:
| 2 | ||||||||||||||||||||||||
290 | } | - | ||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||
292 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
Source code | Switch to Preprocessed file |