Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtOpenGL 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 Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | /* | - |
43 | When the active program changes, we need to update it's uniforms. | - |
44 | We could track state for each program and only update stale uniforms | - |
45 | - Could lead to lots of overhead if there's a lot of programs | - |
46 | We could update all the uniforms when the program changes | - |
47 | - Could end up updating lots of uniforms which don't need updating | - |
48 | | - |
49 | Updating uniforms should be cheap, so the overhead of updating up-to-date | - |
50 | uniforms should be minimal. It's also less complex. | - |
51 | | - |
52 | Things which _may_ cause a different program to be used: | - |
53 | - Change in brush/pen style | - |
54 | - Change in painter opacity | - |
55 | - Change in composition mode | - |
56 | | - |
57 | Whenever we set a mode on the shader manager - it needs to tell us if it had | - |
58 | to switch to a different program. | - |
59 | | - |
60 | The shader manager should only switch when we tell it to. E.g. if we set a new | - |
61 | brush style and then switch to transparent painter, we only want it to compile | - |
62 | and use the correct program when we really need it. | - |
63 | */ | - |
64 | | - |
65 | // #define QT_OPENGL_CACHE_AS_VBOS | - |
66 | | - |
67 | #include "qglgradientcache_p.h" | - |
68 | #include "qpaintengineex_opengl2_p.h" | - |
69 | | - |
70 | #include <string.h> //for memcpy | - |
71 | #include <qmath.h> | - |
72 | | - |
73 | #include <private/qgl_p.h> | - |
74 | #include <private/qmath_p.h> | - |
75 | #include <private/qpaintengineex_p.h> | - |
76 | #include <QPaintEngine> | - |
77 | #include <private/qpainter_p.h> | - |
78 | #include <private/qfontengine_p.h> | - |
79 | #include <private/qdatabuffer_p.h> | - |
80 | #include <private/qstatictext_p.h> | - |
81 | #include <QtGui/private/qtriangulator_p.h> | - |
82 | | - |
83 | #include "qglengineshadermanager_p.h" | - |
84 | #include "qgl2pexvertexarray_p.h" | - |
85 | #include "qtextureglyphcache_gl_p.h" | - |
86 | | - |
87 | #include <QDebug> | - |
88 | | - |
89 | // ####TODO Properly #ifdef this class to use #define symbols actually defined | - |
90 | // by OpenGL/ES includes | - |
91 | #ifndef GL_FRAMEBUFFER_SRGB | - |
92 | #define GL_FRAMEBUFFER_SRGB 0x8DB9 | - |
93 | #endif | - |
94 | | - |
95 | QT_BEGIN_NAMESPACE | - |
96 | | - |
97 | | - |
98 | | - |
99 | Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert); | - |
100 | | - |
101 | ////////////////////////////////// Private Methods ////////////////////////////////////////// | - |
102 | | - |
103 | QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate() | - |
104 | { | - |
105 | delete shaderManager; never executed (the execution status of this line is deduced): delete shaderManager; | - |
106 | | - |
107 | while (pathCaches.size()) { never evaluated: pathCaches.size() | 0 |
108 | QVectorPath::CacheEntry *e = *(pathCaches.constBegin()); never executed (the execution status of this line is deduced): QVectorPath::CacheEntry *e = *(pathCaches.constBegin()); | - |
109 | e->cleanup(e->engine, e->data); never executed (the execution status of this line is deduced): e->cleanup(e->engine, e->data); | - |
110 | e->data = 0; never executed (the execution status of this line is deduced): e->data = 0; | - |
111 | e->engine = 0; never executed (the execution status of this line is deduced): e->engine = 0; | - |
112 | } | 0 |
113 | | - |
114 | if (elementIndicesVBOId != 0) { never evaluated: elementIndicesVBOId != 0 | 0 |
115 | glDeleteBuffers(1, &elementIndicesVBOId); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteBuffers(1, &elementIndicesVBOId); | - |
116 | elementIndicesVBOId = 0; never executed (the execution status of this line is deduced): elementIndicesVBOId = 0; | - |
117 | } | 0 |
118 | } | 0 |
119 | | - |
120 | void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id) | - |
121 | { | - |
122 | // glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit? | - |
123 | if (id != GLuint(-1) && id == lastTextureUsed) never evaluated: id != GLuint(-1) never evaluated: id == lastTextureUsed | 0 |
124 | return; | 0 |
125 | | - |
126 | lastTextureUsed = id; never executed (the execution status of this line is deduced): lastTextureUsed = id; | - |
127 | | - |
128 | if (smoothPixmapTransform) { never evaluated: smoothPixmapTransform | 0 |
129 | glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); never executed (the execution status of this line is deduced): glTexParameteri(target, 0x2800, 0x2601); | - |
130 | glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); never executed (the execution status of this line is deduced): glTexParameteri(target, 0x2801, 0x2601); | - |
131 | } else { | 0 |
132 | glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); never executed (the execution status of this line is deduced): glTexParameteri(target, 0x2800, 0x2600); | - |
133 | glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); never executed (the execution status of this line is deduced): glTexParameteri(target, 0x2801, 0x2600); | - |
134 | } | 0 |
135 | glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode); never executed (the execution status of this line is deduced): glTexParameteri(target, 0x2802, wrapMode); | - |
136 | glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode); never executed (the execution status of this line is deduced): glTexParameteri(target, 0x2803, wrapMode); | - |
137 | } | 0 |
138 | | - |
139 | | - |
140 | inline QColor qt_premultiplyColor(QColor c, GLfloat opacity) | - |
141 | { | - |
142 | qreal alpha = c.alphaF() * opacity; never executed (the execution status of this line is deduced): qreal alpha = c.alphaF() * opacity; | - |
143 | c.setAlphaF(alpha); never executed (the execution status of this line is deduced): c.setAlphaF(alpha); | - |
144 | c.setRedF(c.redF() * alpha); never executed (the execution status of this line is deduced): c.setRedF(c.redF() * alpha); | - |
145 | c.setGreenF(c.greenF() * alpha); never executed (the execution status of this line is deduced): c.setGreenF(c.greenF() * alpha); | - |
146 | c.setBlueF(c.blueF() * alpha); never executed (the execution status of this line is deduced): c.setBlueF(c.blueF() * alpha); | - |
147 | return c; never executed: return c; | 0 |
148 | } | - |
149 | | - |
150 | | - |
151 | void QGL2PaintEngineExPrivate::setBrush(const QBrush& brush) | - |
152 | { | - |
153 | if (qbrush_fast_equals(currentBrush, brush)) never evaluated: qbrush_fast_equals(currentBrush, brush) | 0 |
154 | return; | 0 |
155 | | - |
156 | const Qt::BrushStyle newStyle = qbrush_style(brush); never executed (the execution status of this line is deduced): const Qt::BrushStyle newStyle = qbrush_style(brush); | - |
157 | Q_ASSERT(newStyle != Qt::NoBrush); never executed (the execution status of this line is deduced): qt_noop(); | - |
158 | | - |
159 | currentBrush = brush; never executed (the execution status of this line is deduced): currentBrush = brush; | - |
160 | if (!currentBrushPixmap.isNull()) never evaluated: !currentBrushPixmap.isNull() | 0 |
161 | currentBrushPixmap = QPixmap(); never executed: currentBrushPixmap = QPixmap(); | 0 |
162 | brushUniformsDirty = true; // All brushes have at least one uniform never executed (the execution status of this line is deduced): brushUniformsDirty = true; | - |
163 | | - |
164 | if (newStyle > Qt::SolidPattern) never evaluated: newStyle > Qt::SolidPattern | 0 |
165 | brushTextureDirty = true; never executed: brushTextureDirty = true; | 0 |
166 | | - |
167 | if (currentBrush.style() == Qt::TexturePattern never evaluated: currentBrush.style() == Qt::TexturePattern | 0 |
168 | && qHasPixmapTexture(brush) && brush.texture().isQBitmap()) never evaluated: qHasPixmapTexture(brush) never evaluated: brush.texture().isQBitmap() | 0 |
169 | { | - |
170 | shaderManager->setSrcPixelType(QGLEngineShaderManager::TextureSrcWithPattern); never executed (the execution status of this line is deduced): shaderManager->setSrcPixelType(QGLEngineShaderManager::TextureSrcWithPattern); | - |
171 | } else { | 0 |
172 | shaderManager->setSrcPixelType(newStyle); never executed (the execution status of this line is deduced): shaderManager->setSrcPixelType(newStyle); | - |
173 | } | 0 |
174 | shaderManager->optimiseForBrushTransform(currentBrush.transform().type()); never executed (the execution status of this line is deduced): shaderManager->optimiseForBrushTransform(currentBrush.transform().type()); | - |
175 | } | 0 |
176 | | - |
177 | | - |
178 | void QGL2PaintEngineExPrivate::useSimpleShader() | - |
179 | { | - |
180 | shaderManager->useSimpleProgram(); never executed (the execution status of this line is deduced): shaderManager->useSimpleProgram(); | - |
181 | | - |
182 | if (matrixDirty) never evaluated: matrixDirty | 0 |
183 | updateMatrix(); never executed: updateMatrix(); | 0 |
184 | } | 0 |
185 | | - |
186 | // ####TODO Properly #ifdef this class to use #define symbols actually defined | - |
187 | // by OpenGL/ES includes | - |
188 | #ifndef GL_MIRRORED_REPEAT_IBM | - |
189 | #define GL_MIRRORED_REPEAT_IBM 0x8370 | - |
190 | #endif | - |
191 | | - |
192 | void QGL2PaintEngineExPrivate::updateBrushTexture() | - |
193 | { | - |
194 | Q_Q(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineEx * const q = q_func(); | - |
195 | // qDebug("QGL2PaintEngineExPrivate::updateBrushTexture()"); | - |
196 | Qt::BrushStyle style = currentBrush.style(); never executed (the execution status of this line is deduced): Qt::BrushStyle style = currentBrush.style(); | - |
197 | | - |
198 | if ( (style >= Qt::Dense1Pattern) && (style <= Qt::DiagCrossPattern) ) { never evaluated: (style >= Qt::Dense1Pattern) never evaluated: (style <= Qt::DiagCrossPattern) | 0 |
199 | // Get the image data for the pattern | - |
200 | QImage texImage = qt_imageForBrush(style, false); never executed (the execution status of this line is deduced): QImage texImage = qt_imageForBrush(style, false); | - |
201 | | - |
202 | glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(0)); | - |
203 | ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); never executed (the execution status of this line is deduced): ctx->d_func()->bindTexture(texImage, 0x0DE1, 0x1908, QGLContext::InternalBindOption); | - |
204 | updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); never executed (the execution status of this line is deduced): updateTextureFilter(0x0DE1, 0x2901, q->state()->renderHints & QPainter::SmoothPixmapTransform); | - |
205 | } | 0 |
206 | else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { never evaluated: style >= Qt::LinearGradientPattern never evaluated: style <= Qt::ConicalGradientPattern | 0 |
207 | // Gradiant brush: All the gradiants use the same texture | - |
208 | | - |
209 | const QGradient* g = currentBrush.gradient(); never executed (the execution status of this line is deduced): const QGradient* g = currentBrush.gradient(); | - |
210 | | - |
211 | // We apply global opacity in the fragment shaders, so we always pass 1.0 | - |
212 | // for opacity to the cache. | - |
213 | GLuint texId = QGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0); never executed (the execution status of this line is deduced): GLuint texId = QGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0); | - |
214 | | - |
215 | glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(0)); | - |
216 | glBindTexture(GL_TEXTURE_2D, texId); never executed (the execution status of this line is deduced): glBindTexture(0x0DE1, texId); | - |
217 | | - |
218 | if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient) never evaluated: g->spread() == QGradient::RepeatSpread never evaluated: g->type() == QGradient::ConicalGradient | 0 |
219 | updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); never executed: updateTextureFilter(0x0DE1, 0x2901, q->state()->renderHints & QPainter::SmoothPixmapTransform); | 0 |
220 | else if (g->spread() == QGradient::ReflectSpread) never evaluated: g->spread() == QGradient::ReflectSpread | 0 |
221 | updateTextureFilter(GL_TEXTURE_2D, GL_MIRRORED_REPEAT_IBM, q->state()->renderHints & QPainter::SmoothPixmapTransform); never executed: updateTextureFilter(0x0DE1, 0x8370, q->state()->renderHints & QPainter::SmoothPixmapTransform); | 0 |
222 | else | - |
223 | updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform); never executed: updateTextureFilter(0x0DE1, 0x812F, q->state()->renderHints & QPainter::SmoothPixmapTransform); | 0 |
224 | } | - |
225 | else if (style == Qt::TexturePattern) { never evaluated: style == Qt::TexturePattern | 0 |
226 | currentBrushPixmap = currentBrush.texture(); never executed (the execution status of this line is deduced): currentBrushPixmap = currentBrush.texture(); | - |
227 | | - |
228 | int max_texture_size = ctx->d_func()->maxTextureSize(); never executed (the execution status of this line is deduced): int max_texture_size = ctx->d_func()->maxTextureSize(); | - |
229 | if (currentBrushPixmap.width() > max_texture_size || currentBrushPixmap.height() > max_texture_size) never evaluated: currentBrushPixmap.width() > max_texture_size never evaluated: currentBrushPixmap.height() > max_texture_size | 0 |
230 | currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); never executed: currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); | 0 |
231 | | - |
232 | glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(0)); | - |
233 | QGLTexture *tex = ctx->d_func()->bindTexture(currentBrushPixmap, GL_TEXTURE_2D, GL_RGBA, never executed (the execution status of this line is deduced): QGLTexture *tex = ctx->d_func()->bindTexture(currentBrushPixmap, 0x0DE1, 0x1908, | - |
234 | QGLContext::InternalBindOption | never executed (the execution status of this line is deduced): QGLContext::InternalBindOption | | - |
235 | QGLContext::CanFlipNativePixmapBindOption); never executed (the execution status of this line is deduced): QGLContext::CanFlipNativePixmapBindOption); | - |
236 | updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); never executed (the execution status of this line is deduced): updateTextureFilter(0x0DE1, 0x2901, q->state()->renderHints & QPainter::SmoothPixmapTransform); | - |
237 | textureInvertedY = tex->options & QGLContext::InvertedYBindOption ? -1 : 1; never evaluated: tex->options & QGLContext::InvertedYBindOption | 0 |
238 | } | 0 |
239 | brushTextureDirty = false; never executed (the execution status of this line is deduced): brushTextureDirty = false; | - |
240 | } | 0 |
241 | | - |
242 | | - |
243 | void QGL2PaintEngineExPrivate::updateBrushUniforms() | - |
244 | { | - |
245 | // qDebug("QGL2PaintEngineExPrivate::updateBrushUniforms()"); | - |
246 | Qt::BrushStyle style = currentBrush.style(); never executed (the execution status of this line is deduced): Qt::BrushStyle style = currentBrush.style(); | - |
247 | | - |
248 | if (style == Qt::NoBrush) never evaluated: style == Qt::NoBrush | 0 |
249 | return; | 0 |
250 | | - |
251 | QTransform brushQTransform = currentBrush.transform(); never executed (the execution status of this line is deduced): QTransform brushQTransform = currentBrush.transform(); | - |
252 | | - |
253 | if (style == Qt::SolidPattern) { never evaluated: style == Qt::SolidPattern | 0 |
254 | QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); never executed (the execution status of this line is deduced): QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); | - |
255 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::FragmentColor), col); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::FragmentColor), col); | - |
256 | } | 0 |
257 | else { | - |
258 | // All other brushes have a transform and thus need the translation point: | - |
259 | QPointF translationPoint; never executed (the execution status of this line is deduced): QPointF translationPoint; | - |
260 | | - |
261 | if (style <= Qt::DiagCrossPattern) { never evaluated: style <= Qt::DiagCrossPattern | 0 |
262 | QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); never executed (the execution status of this line is deduced): QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); | - |
263 | | - |
264 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); | - |
265 | | - |
266 | QVector2D halfViewportSize(width*0.5, height*0.5); never executed (the execution status of this line is deduced): QVector2D halfViewportSize(width*0.5, height*0.5); | - |
267 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - |
268 | } | 0 |
269 | else if (style == Qt::LinearGradientPattern) { never evaluated: style == Qt::LinearGradientPattern | 0 |
270 | const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush.gradient()); never executed (the execution status of this line is deduced): const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush.gradient()); | - |
271 | | - |
272 | QPointF realStart = g->start(); never executed (the execution status of this line is deduced): QPointF realStart = g->start(); | - |
273 | QPointF realFinal = g->finalStop(); never executed (the execution status of this line is deduced): QPointF realFinal = g->finalStop(); | - |
274 | translationPoint = realStart; never executed (the execution status of this line is deduced): translationPoint = realStart; | - |
275 | | - |
276 | QPointF l = realFinal - realStart; never executed (the execution status of this line is deduced): QPointF l = realFinal - realStart; | - |
277 | | - |
278 | QVector3D linearData( never executed (the execution status of this line is deduced): QVector3D linearData( | - |
279 | l.x(), never executed (the execution status of this line is deduced): l.x(), | - |
280 | l.y(), never executed (the execution status of this line is deduced): l.y(), | - |
281 | 1.0f / (l.x() * l.x() + l.y() * l.y()) never executed (the execution status of this line is deduced): 1.0f / (l.x() * l.x() + l.y() * l.y()) | - |
282 | ); never executed (the execution status of this line is deduced): ); | - |
283 | | - |
284 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::LinearData), linearData); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::LinearData), linearData); | - |
285 | | - |
286 | QVector2D halfViewportSize(width*0.5, height*0.5); never executed (the execution status of this line is deduced): QVector2D halfViewportSize(width*0.5, height*0.5); | - |
287 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - |
288 | } | 0 |
289 | else if (style == Qt::ConicalGradientPattern) { never evaluated: style == Qt::ConicalGradientPattern | 0 |
290 | const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush.gradient()); never executed (the execution status of this line is deduced): const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush.gradient()); | - |
291 | translationPoint = g->center(); never executed (the execution status of this line is deduced): translationPoint = g->center(); | - |
292 | | - |
293 | GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0; never executed (the execution status of this line is deduced): GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0; | - |
294 | | - |
295 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Angle), angle); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Angle), angle); | - |
296 | | - |
297 | QVector2D halfViewportSize(width*0.5, height*0.5); never executed (the execution status of this line is deduced): QVector2D halfViewportSize(width*0.5, height*0.5); | - |
298 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - |
299 | } | 0 |
300 | else if (style == Qt::RadialGradientPattern) { never evaluated: style == Qt::RadialGradientPattern | 0 |
301 | const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush.gradient()); never executed (the execution status of this line is deduced): const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush.gradient()); | - |
302 | QPointF realCenter = g->center(); never executed (the execution status of this line is deduced): QPointF realCenter = g->center(); | - |
303 | QPointF realFocal = g->focalPoint(); never executed (the execution status of this line is deduced): QPointF realFocal = g->focalPoint(); | - |
304 | qreal realRadius = g->centerRadius() - g->focalRadius(); never executed (the execution status of this line is deduced): qreal realRadius = g->centerRadius() - g->focalRadius(); | - |
305 | translationPoint = realFocal; never executed (the execution status of this line is deduced): translationPoint = realFocal; | - |
306 | | - |
307 | QPointF fmp = realCenter - realFocal; never executed (the execution status of this line is deduced): QPointF fmp = realCenter - realFocal; | - |
308 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp), fmp); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp), fmp); | - |
309 | | - |
310 | GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius; never executed (the execution status of this line is deduced): GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius; | - |
311 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp2MRadius2), fmp2_m_radius2); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp2MRadius2), fmp2_m_radius2); | - |
312 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Inverse2Fmp2MRadius2), never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Inverse2Fmp2MRadius2), | - |
313 | GLfloat(1.0 / (2.0*fmp2_m_radius2))); never executed (the execution status of this line is deduced): GLfloat(1.0 / (2.0*fmp2_m_radius2))); | - |
314 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::SqrFr), never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::SqrFr), | - |
315 | GLfloat(g->focalRadius() * g->focalRadius())); never executed (the execution status of this line is deduced): GLfloat(g->focalRadius() * g->focalRadius())); | - |
316 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BRadius), never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BRadius), | - |
317 | GLfloat(2 * (g->centerRadius() - g->focalRadius()) * g->focalRadius()), never executed (the execution status of this line is deduced): GLfloat(2 * (g->centerRadius() - g->focalRadius()) * g->focalRadius()), | - |
318 | g->focalRadius(), never executed (the execution status of this line is deduced): g->focalRadius(), | - |
319 | g->centerRadius() - g->focalRadius()); never executed (the execution status of this line is deduced): g->centerRadius() - g->focalRadius()); | - |
320 | | - |
321 | QVector2D halfViewportSize(width*0.5, height*0.5); never executed (the execution status of this line is deduced): QVector2D halfViewportSize(width*0.5, height*0.5); | - |
322 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - |
323 | } | 0 |
324 | else if (style == Qt::TexturePattern) { never evaluated: style == Qt::TexturePattern | 0 |
325 | const QPixmap& texPixmap = currentBrush.texture(); never executed (the execution status of this line is deduced): const QPixmap& texPixmap = currentBrush.texture(); | - |
326 | | - |
327 | if (qHasPixmapTexture(currentBrush) && currentBrush.texture().isQBitmap()) { never evaluated: qHasPixmapTexture(currentBrush) never evaluated: currentBrush.texture().isQBitmap() | 0 |
328 | QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); never executed (the execution status of this line is deduced): QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); | - |
329 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); | - |
330 | } | 0 |
331 | | - |
332 | QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 / texPixmap.height()); never executed (the execution status of this line is deduced): QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 / texPixmap.height()); | - |
333 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); | - |
334 | | - |
335 | QVector2D halfViewportSize(width*0.5, height*0.5); never executed (the execution status of this line is deduced): QVector2D halfViewportSize(width*0.5, height*0.5); | - |
336 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - |
337 | } | 0 |
338 | else | - |
339 | qWarning("QGL2PaintEngineEx: Unimplemented fill style"); never executed: QMessageLogger("gl2paintengineex/qpaintengineex_opengl2.cpp", 339, __PRETTY_FUNCTION__).warning("QGL2PaintEngineEx: Unimplemented fill style"); | 0 |
340 | | - |
341 | const QPointF &brushOrigin = q->state()->brushOrigin; never executed (the execution status of this line is deduced): const QPointF &brushOrigin = q->state()->brushOrigin; | - |
342 | QTransform matrix = q->state()->matrix; never executed (the execution status of this line is deduced): QTransform matrix = q->state()->matrix; | - |
343 | matrix.translate(brushOrigin.x(), brushOrigin.y()); never executed (the execution status of this line is deduced): matrix.translate(brushOrigin.x(), brushOrigin.y()); | - |
344 | | - |
345 | QTransform translate(1, 0, 0, 1, -translationPoint.x(), -translationPoint.y()); never executed (the execution status of this line is deduced): QTransform translate(1, 0, 0, 1, -translationPoint.x(), -translationPoint.y()); | - |
346 | qreal m22 = -1; never executed (the execution status of this line is deduced): qreal m22 = -1; | - |
347 | qreal dy = height; never executed (the execution status of this line is deduced): qreal dy = height; | - |
348 | if (device->isFlipped()) { never evaluated: device->isFlipped() | 0 |
349 | m22 = 1; never executed (the execution status of this line is deduced): m22 = 1; | - |
350 | dy = 0; never executed (the execution status of this line is deduced): dy = 0; | - |
351 | } | 0 |
352 | QTransform gl_to_qt(1, 0, 0, m22, 0, dy); never executed (the execution status of this line is deduced): QTransform gl_to_qt(1, 0, 0, m22, 0, dy); | - |
353 | QTransform inv_matrix; never executed (the execution status of this line is deduced): QTransform inv_matrix; | - |
354 | if (style == Qt::TexturePattern && textureInvertedY == -1) never evaluated: style == Qt::TexturePattern never evaluated: textureInvertedY == -1 | 0 |
355 | inv_matrix = gl_to_qt * (QTransform(1, 0, 0, -1, 0, currentBrush.texture().height()) * brushQTransform * matrix).inverted() * translate; never executed: inv_matrix = gl_to_qt * (QTransform(1, 0, 0, -1, 0, currentBrush.texture().height()) * brushQTransform * matrix).inverted() * translate; | 0 |
356 | else | - |
357 | inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate; never executed: inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate; | 0 |
358 | | - |
359 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTransform), inv_matrix); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTransform), inv_matrix); | - |
360 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTexture), QT_BRUSH_TEXTURE_UNIT); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTexture), GLuint(0)); | - |
361 | } | 0 |
362 | brushUniformsDirty = false; never executed (the execution status of this line is deduced): brushUniformsDirty = false; | - |
363 | } | 0 |
364 | | - |
365 | | - |
366 | // This assumes the shader manager has already setup the correct shader program | - |
367 | void QGL2PaintEngineExPrivate::updateMatrix() | - |
368 | { | - |
369 | // qDebug("QGL2PaintEngineExPrivate::updateMatrix()"); | - |
370 | | - |
371 | const QTransform& transform = q->state()->matrix; never executed (the execution status of this line is deduced): const QTransform& transform = q->state()->matrix; | - |
372 | | - |
373 | // The projection matrix converts from Qt's coordinate system to GL's coordinate system | - |
374 | // * GL's viewport is 2x2, Qt's is width x height | - |
375 | // * GL has +y -> -y going from bottom -> top, Qt is the other way round | - |
376 | // * GL has [0,0] in the center, Qt has it in the top-left | - |
377 | // | - |
378 | // This results in the Projection matrix below, which is multiplied by the painter's | - |
379 | // transformation matrix, as shown below: | - |
380 | // | - |
381 | // Projection Matrix Painter Transform | - |
382 | // ------------------------------------------------ ------------------------ | - |
383 | // | 2.0 / width | 0.0 | -1.0 | | m11 | m21 | dx | | - |
384 | // | 0.0 | -2.0 / height | 1.0 | * | m12 | m22 | dy | | - |
385 | // | 0.0 | 0.0 | 1.0 | | m13 | m23 | m33 | | - |
386 | // ------------------------------------------------ ------------------------ | - |
387 | // | - |
388 | // NOTE: The resultant matrix is also transposed, as GL expects column-major matracies | - |
389 | | - |
390 | const GLfloat wfactor = 2.0f / width; never executed (the execution status of this line is deduced): const GLfloat wfactor = 2.0f / width; | - |
391 | GLfloat hfactor = -2.0f / height; never executed (the execution status of this line is deduced): GLfloat hfactor = -2.0f / height; | - |
392 | | - |
393 | GLfloat dx = transform.dx(); never executed (the execution status of this line is deduced): GLfloat dx = transform.dx(); | - |
394 | GLfloat dy = transform.dy(); never executed (the execution status of this line is deduced): GLfloat dy = transform.dy(); | - |
395 | | - |
396 | if (device->isFlipped()) { never evaluated: device->isFlipped() | 0 |
397 | hfactor *= -1; never executed (the execution status of this line is deduced): hfactor *= -1; | - |
398 | dy -= height; never executed (the execution status of this line is deduced): dy -= height; | - |
399 | } | 0 |
400 | | - |
401 | // Non-integer translates can have strange effects for some rendering operations such as | - |
402 | // anti-aliased text rendering. In such cases, we snap the translate to the pixel grid. | - |
403 | if (snapToPixelGrid && transform.type() == QTransform::TxTranslate) { never evaluated: snapToPixelGrid never evaluated: transform.type() == QTransform::TxTranslate | 0 |
404 | // 0.50 needs to rounded down to 0.0 for consistency with raster engine: | - |
405 | dx = ceilf(dx - 0.5f); never executed (the execution status of this line is deduced): dx = ceilf(dx - 0.5f); | - |
406 | dy = ceilf(dy - 0.5f); never executed (the execution status of this line is deduced): dy = ceilf(dy - 0.5f); | - |
407 | } | 0 |
408 | pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13(); never executed (the execution status of this line is deduced): pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13(); | - |
409 | pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23(); never executed (the execution status of this line is deduced): pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23(); | - |
410 | pmvMatrix[2][0] = (wfactor * dx) - transform.m33(); never executed (the execution status of this line is deduced): pmvMatrix[2][0] = (wfactor * dx) - transform.m33(); | - |
411 | pmvMatrix[0][1] = (hfactor * transform.m12()) + transform.m13(); never executed (the execution status of this line is deduced): pmvMatrix[0][1] = (hfactor * transform.m12()) + transform.m13(); | - |
412 | pmvMatrix[1][1] = (hfactor * transform.m22()) + transform.m23(); never executed (the execution status of this line is deduced): pmvMatrix[1][1] = (hfactor * transform.m22()) + transform.m23(); | - |
413 | pmvMatrix[2][1] = (hfactor * dy) + transform.m33(); never executed (the execution status of this line is deduced): pmvMatrix[2][1] = (hfactor * dy) + transform.m33(); | - |
414 | pmvMatrix[0][2] = transform.m13(); never executed (the execution status of this line is deduced): pmvMatrix[0][2] = transform.m13(); | - |
415 | pmvMatrix[1][2] = transform.m23(); never executed (the execution status of this line is deduced): pmvMatrix[1][2] = transform.m23(); | - |
416 | pmvMatrix[2][2] = transform.m33(); never executed (the execution status of this line is deduced): pmvMatrix[2][2] = transform.m33(); | - |
417 | | - |
418 | // 1/10000 == 0.0001, so we have good enough res to cover curves | - |
419 | // that span the entire widget... | - |
420 | inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())), never executed (the execution status of this line is deduced): inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())), | - |
421 | qMax(qAbs(transform.m12()), qAbs(transform.m21())) ), never executed (the execution status of this line is deduced): qMax(qAbs(transform.m12()), qAbs(transform.m21())) ), | - |
422 | qreal(0.0001)); never executed (the execution status of this line is deduced): qreal(0.0001)); | - |
423 | | - |
424 | matrixDirty = false; never executed (the execution status of this line is deduced): matrixDirty = false; | - |
425 | matrixUniformDirty = true; never executed (the execution status of this line is deduced): matrixUniformDirty = true; | - |
426 | | - |
427 | // Set the PMV matrix attribute. As we use an attributes rather than uniforms, we only | - |
428 | // need to do this once for every matrix change and persists across all shader programs. | - |
429 | glVertexAttrib3fv(QT_PMV_MATRIX_1_ATTR, pmvMatrix[0]); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib3fv(QT_PMV_MATRIX_1_ATTR, pmvMatrix[0]); | - |
430 | glVertexAttrib3fv(QT_PMV_MATRIX_2_ATTR, pmvMatrix[1]); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib3fv(QT_PMV_MATRIX_2_ATTR, pmvMatrix[1]); | - |
431 | glVertexAttrib3fv(QT_PMV_MATRIX_3_ATTR, pmvMatrix[2]); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib3fv(QT_PMV_MATRIX_3_ATTR, pmvMatrix[2]); | - |
432 | | - |
433 | dasher.setInvScale(inverseScale); never executed (the execution status of this line is deduced): dasher.setInvScale(inverseScale); | - |
434 | stroker.setInvScale(inverseScale); never executed (the execution status of this line is deduced): stroker.setInvScale(inverseScale); | - |
435 | } | 0 |
436 | | - |
437 | | - |
438 | void QGL2PaintEngineExPrivate::updateCompositionMode() | - |
439 | { | - |
440 | // NOTE: The entire paint engine works on pre-multiplied data - which is why some of these | - |
441 | // composition modes look odd. | - |
442 | // qDebug() << "QGL2PaintEngineExPrivate::updateCompositionMode() - Setting GL composition mode for " << q->state()->composition_mode; | - |
443 | switch(q->state()->composition_mode) { | - |
444 | case QPainter::CompositionMode_SourceOver: | - |
445 | glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); never executed (the execution status of this line is deduced): glBlendFunc(0x1, 0x0303); | - |
446 | break; | 0 |
447 | case QPainter::CompositionMode_DestinationOver: | - |
448 | glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); never executed (the execution status of this line is deduced): glBlendFunc(0x0305, 0x1); | - |
449 | break; | 0 |
450 | case QPainter::CompositionMode_Clear: | - |
451 | glBlendFunc(GL_ZERO, GL_ZERO); never executed (the execution status of this line is deduced): glBlendFunc(0x0, 0x0); | - |
452 | break; | 0 |
453 | case QPainter::CompositionMode_Source: | - |
454 | glBlendFunc(GL_ONE, GL_ZERO); never executed (the execution status of this line is deduced): glBlendFunc(0x1, 0x0); | - |
455 | break; | 0 |
456 | case QPainter::CompositionMode_Destination: | - |
457 | glBlendFunc(GL_ZERO, GL_ONE); never executed (the execution status of this line is deduced): glBlendFunc(0x0, 0x1); | - |
458 | break; | 0 |
459 | case QPainter::CompositionMode_SourceIn: | - |
460 | glBlendFunc(GL_DST_ALPHA, GL_ZERO); never executed (the execution status of this line is deduced): glBlendFunc(0x0304, 0x0); | - |
461 | break; | 0 |
462 | case QPainter::CompositionMode_DestinationIn: | - |
463 | glBlendFunc(GL_ZERO, GL_SRC_ALPHA); never executed (the execution status of this line is deduced): glBlendFunc(0x0, 0x0302); | - |
464 | break; | 0 |
465 | case QPainter::CompositionMode_SourceOut: | - |
466 | glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO); never executed (the execution status of this line is deduced): glBlendFunc(0x0305, 0x0); | - |
467 | break; | 0 |
468 | case QPainter::CompositionMode_DestinationOut: | - |
469 | glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); never executed (the execution status of this line is deduced): glBlendFunc(0x0, 0x0303); | - |
470 | break; | 0 |
471 | case QPainter::CompositionMode_SourceAtop: | - |
472 | glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); never executed (the execution status of this line is deduced): glBlendFunc(0x0304, 0x0303); | - |
473 | break; | 0 |
474 | case QPainter::CompositionMode_DestinationAtop: | - |
475 | glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA); never executed (the execution status of this line is deduced): glBlendFunc(0x0305, 0x0302); | - |
476 | break; | 0 |
477 | case QPainter::CompositionMode_Xor: | - |
478 | glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); never executed (the execution status of this line is deduced): glBlendFunc(0x0305, 0x0303); | - |
479 | break; | 0 |
480 | case QPainter::CompositionMode_Plus: | - |
481 | glBlendFunc(GL_ONE, GL_ONE); never executed (the execution status of this line is deduced): glBlendFunc(0x1, 0x1); | - |
482 | break; | 0 |
483 | default: | - |
484 | qWarning("Unsupported composition mode"); never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qpaintengineex_opengl2.cpp", 484, __PRETTY_FUNCTION__).warning("Unsupported composition mode"); | - |
485 | break; | 0 |
486 | } | - |
487 | | - |
488 | compositionModeDirty = false; never executed (the execution status of this line is deduced): compositionModeDirty = false; | - |
489 | } | 0 |
490 | | - |
491 | static inline void setCoords(GLfloat *coords, const QGLRect &rect) | - |
492 | { | - |
493 | coords[0] = rect.left; never executed (the execution status of this line is deduced): coords[0] = rect.left; | - |
494 | coords[1] = rect.top; never executed (the execution status of this line is deduced): coords[1] = rect.top; | - |
495 | coords[2] = rect.right; never executed (the execution status of this line is deduced): coords[2] = rect.right; | - |
496 | coords[3] = rect.top; never executed (the execution status of this line is deduced): coords[3] = rect.top; | - |
497 | coords[4] = rect.right; never executed (the execution status of this line is deduced): coords[4] = rect.right; | - |
498 | coords[5] = rect.bottom; never executed (the execution status of this line is deduced): coords[5] = rect.bottom; | - |
499 | coords[6] = rect.left; never executed (the execution status of this line is deduced): coords[6] = rect.left; | - |
500 | coords[7] = rect.bottom; never executed (the execution status of this line is deduced): coords[7] = rect.bottom; | - |
501 | } | 0 |
502 | | - |
503 | void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern) | - |
504 | { | - |
505 | // Setup for texture drawing | - |
506 | currentBrush = noBrush; never executed (the execution status of this line is deduced): currentBrush = noBrush; | - |
507 | shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc); never executed (the execution status of this line is deduced): shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc); | - |
508 | | - |
509 | if (snapToPixelGrid) { never evaluated: snapToPixelGrid | 0 |
510 | snapToPixelGrid = false; never executed (the execution status of this line is deduced): snapToPixelGrid = false; | - |
511 | matrixDirty = true; never executed (the execution status of this line is deduced): matrixDirty = true; | - |
512 | } | 0 |
513 | | - |
514 | if (prepareForDraw(opaque)) never evaluated: prepareForDraw(opaque) | 0 |
515 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); never executed: shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), GLuint(0)); | 0 |
516 | | - |
517 | if (pattern) { | 0 |
518 | QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); never executed (the execution status of this line is deduced): QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); | - |
519 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); | - |
520 | } | 0 |
521 | | - |
522 | GLfloat dx = 1.0 / textureSize.width(); never executed (the execution status of this line is deduced): GLfloat dx = 1.0 / textureSize.width(); | - |
523 | GLfloat dy = 1.0 / textureSize.height(); never executed (the execution status of this line is deduced): GLfloat dy = 1.0 / textureSize.height(); | - |
524 | | - |
525 | QGLRect srcTextureRect(src.left*dx, src.top*dy, src.right*dx, src.bottom*dy); never executed (the execution status of this line is deduced): QGLRect srcTextureRect(src.left*dx, src.top*dy, src.right*dx, src.bottom*dy); | - |
526 | | - |
527 | setCoords(staticVertexCoordinateArray, dest); never executed (the execution status of this line is deduced): setCoords(staticVertexCoordinateArray, dest); | - |
528 | setCoords(staticTextureCoordinateArray, srcTextureRect); never executed (the execution status of this line is deduced): setCoords(staticTextureCoordinateArray, srcTextureRect); | - |
529 | | - |
530 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); never executed (the execution status of this line is deduced): glDrawArrays(0x0006, 0, 4); | - |
531 | } | 0 |
532 | | - |
533 | void QGL2PaintEngineEx::beginNativePainting() | - |
534 | { | - |
535 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
536 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
537 | d->transferMode(BrushDrawingMode); never executed (the execution status of this line is deduced): d->transferMode(BrushDrawingMode); | - |
538 | | - |
539 | d->nativePaintingActive = true; never executed (the execution status of this line is deduced): d->nativePaintingActive = true; | - |
540 | | - |
541 | QGLContext *ctx = d->ctx; never executed (the execution status of this line is deduced): QGLContext *ctx = d->ctx; | - |
542 | glUseProgram(0); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glUseProgram(0); | - |
543 | | - |
544 | // Disable all the vertex attribute arrays: | - |
545 | for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) | 0 |
546 | glDisableVertexAttribArray(i); never executed: QGLContextPrivate::extensionFuncs(ctx).qt_glDisableVertexAttribArray(i); | 0 |
547 | | - |
548 | #ifndef QT_OPENGL_ES_2 | - |
549 | const QGLFormat &fmt = d->device->format(); never executed (the execution status of this line is deduced): const QGLFormat &fmt = d->device->format(); | - |
550 | if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1) never evaluated: fmt.majorVersion() < 3 never evaluated: fmt.majorVersion() == 3 never evaluated: fmt.minorVersion() < 1 | 0 |
551 | || fmt.profile() == QGLFormat::CompatibilityProfile) never evaluated: fmt.profile() == QGLFormat::CompatibilityProfile | 0 |
552 | { | - |
553 | // be nice to people who mix OpenGL 1.x code with QPainter commands | - |
554 | // by setting modelview and projection matrices to mirror the GL 1 | - |
555 | // paint engine | - |
556 | const QTransform& mtx = state()->matrix; never executed (the execution status of this line is deduced): const QTransform& mtx = state()->matrix; | - |
557 | | - |
558 | float mv_matrix[4][4] = never executed (the execution status of this line is deduced): float mv_matrix[4][4] = | - |
559 | { never executed (the execution status of this line is deduced): { | - |
560 | { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) }, never executed (the execution status of this line is deduced): { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) }, | - |
561 | { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) }, never executed (the execution status of this line is deduced): { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) }, | - |
562 | { 0, 0, 1, 0 }, never executed (the execution status of this line is deduced): { 0, 0, 1, 0 }, | - |
563 | { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) } never executed (the execution status of this line is deduced): { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) } | - |
564 | }; never executed (the execution status of this line is deduced): }; | - |
565 | | - |
566 | const QSize sz = d->device->size(); never executed (the execution status of this line is deduced): const QSize sz = d->device->size(); | - |
567 | | - |
568 | glMatrixMode(GL_PROJECTION); never executed (the execution status of this line is deduced): glMatrixMode(0x1701); | - |
569 | glLoadIdentity(); never executed (the execution status of this line is deduced): glLoadIdentity(); | - |
570 | glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999); never executed (the execution status of this line is deduced): glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999); | - |
571 | | - |
572 | glMatrixMode(GL_MODELVIEW); never executed (the execution status of this line is deduced): glMatrixMode(0x1700); | - |
573 | glLoadMatrixf(&mv_matrix[0][0]); never executed (the execution status of this line is deduced): glLoadMatrixf(&mv_matrix[0][0]); | - |
574 | } | 0 |
575 | #else | - |
576 | Q_UNUSED(ctx); | - |
577 | #endif | - |
578 | | - |
579 | d->lastTextureUsed = GLuint(-1); never executed (the execution status of this line is deduced): d->lastTextureUsed = GLuint(-1); | - |
580 | d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); never executed (the execution status of this line is deduced): d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); | - |
581 | d->resetGLState(); never executed (the execution status of this line is deduced): d->resetGLState(); | - |
582 | | - |
583 | d->shaderManager->setDirty(); never executed (the execution status of this line is deduced): d->shaderManager->setDirty(); | - |
584 | | - |
585 | d->needsSync = true; never executed (the execution status of this line is deduced): d->needsSync = true; | - |
586 | } | 0 |
587 | | - |
588 | void QGL2PaintEngineExPrivate::resetGLState() | - |
589 | { | - |
590 | glDisable(GL_BLEND); never executed (the execution status of this line is deduced): glDisable(0x0BE2); | - |
591 | glActiveTexture(GL_TEXTURE0); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0); | - |
592 | glDisable(GL_STENCIL_TEST); never executed (the execution status of this line is deduced): glDisable(0x0B90); | - |
593 | glDisable(GL_DEPTH_TEST); never executed (the execution status of this line is deduced): glDisable(0x0B71); | - |
594 | glDisable(GL_SCISSOR_TEST); never executed (the execution status of this line is deduced): glDisable(0x0C11); | - |
595 | glDepthMask(true); never executed (the execution status of this line is deduced): glDepthMask(true); | - |
596 | glDepthFunc(GL_LESS); never executed (the execution status of this line is deduced): glDepthFunc(0x0201); | - |
597 | glClearDepth(1); never executed (the execution status of this line is deduced): glClearDepth(1); | - |
598 | glStencilMask(0xff); never executed (the execution status of this line is deduced): glStencilMask(0xff); | - |
599 | glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x1E00, 0x1E00); | - |
600 | glStencilFunc(GL_ALWAYS, 0, 0xff); never executed (the execution status of this line is deduced): glStencilFunc(0x0207, 0, 0xff); | - |
601 | ctx->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false); never executed (the execution status of this line is deduced): ctx->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false); | - |
602 | ctx->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false); never executed (the execution status of this line is deduced): ctx->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false); | - |
603 | ctx->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); never executed (the execution status of this line is deduced): ctx->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); | - |
604 | #ifndef QT_OPENGL_ES_2 | - |
605 | // gl_Color, corresponding to vertex attribute 3, may have been changed | - |
606 | float color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; never executed (the execution status of this line is deduced): float color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | - |
607 | glVertexAttrib4fv(3, color); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib4fv(3, color); | - |
608 | #endif | - |
609 | } | 0 |
610 | | - |
611 | void QGL2PaintEngineEx::endNativePainting() | - |
612 | { | - |
613 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
614 | d->needsSync = true; never executed (the execution status of this line is deduced): d->needsSync = true; | - |
615 | d->nativePaintingActive = false; never executed (the execution status of this line is deduced): d->nativePaintingActive = false; | - |
616 | } | 0 |
617 | | - |
618 | void QGL2PaintEngineEx::invalidateState() | - |
619 | { | - |
620 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
621 | d->needsSync = true; never executed (the execution status of this line is deduced): d->needsSync = true; | - |
622 | } | 0 |
623 | | - |
624 | bool QGL2PaintEngineEx::isNativePaintingActive() const { | - |
625 | Q_D(const QGL2PaintEngineEx); never executed (the execution status of this line is deduced): const QGL2PaintEngineExPrivate * const d = d_func(); | - |
626 | return d->nativePaintingActive; never executed: return d->nativePaintingActive; | 0 |
627 | } | - |
628 | | - |
629 | void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) | - |
630 | { | - |
631 | if (newMode == mode) never evaluated: newMode == mode | 0 |
632 | return; | 0 |
633 | | - |
634 | if (mode == TextDrawingMode || mode == ImageDrawingMode || mode == ImageArrayDrawingMode) { never evaluated: mode == TextDrawingMode never evaluated: mode == ImageDrawingMode never evaluated: mode == ImageArrayDrawingMode | 0 |
635 | lastTextureUsed = GLuint(-1); never executed (the execution status of this line is deduced): lastTextureUsed = GLuint(-1); | - |
636 | } | 0 |
637 | | - |
638 | if (newMode == TextDrawingMode) { never evaluated: newMode == TextDrawingMode | 0 |
639 | shaderManager->setHasComplexGeometry(true); never executed (the execution status of this line is deduced): shaderManager->setHasComplexGeometry(true); | - |
640 | } else { | 0 |
641 | shaderManager->setHasComplexGeometry(false); never executed (the execution status of this line is deduced): shaderManager->setHasComplexGeometry(false); | - |
642 | } | 0 |
643 | | - |
644 | if (newMode == ImageDrawingMode) { never evaluated: newMode == ImageDrawingMode | 0 |
645 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); | - |
646 | setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray); | - |
647 | } | 0 |
648 | | - |
649 | if (newMode == ImageArrayDrawingMode) { never evaluated: newMode == ImageArrayDrawingMode | 0 |
650 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); | - |
651 | setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); | - |
652 | setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data()); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data()); | - |
653 | } | 0 |
654 | | - |
655 | // This needs to change when we implement high-quality anti-aliasing... | - |
656 | if (newMode != TextDrawingMode) never evaluated: newMode != TextDrawingMode | 0 |
657 | shaderManager->setMaskType(QGLEngineShaderManager::NoMask); never executed: shaderManager->setMaskType(QGLEngineShaderManager::NoMask); | 0 |
658 | | - |
659 | mode = newMode; never executed (the execution status of this line is deduced): mode = newMode; | - |
660 | } | 0 |
661 | | - |
662 | struct QGL2PEVectorPathCache | - |
663 | { | - |
664 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
665 | GLuint vbo; | - |
666 | GLuint ibo; | - |
667 | #else | - |
668 | float *vertices; | - |
669 | void *indices; | - |
670 | #endif | - |
671 | int vertexCount; | - |
672 | int indexCount; | - |
673 | GLenum primitiveType; | - |
674 | qreal iscale; | - |
675 | QVertexIndexVector::Type indexType; | - |
676 | }; | - |
677 | | - |
678 | void QGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, void *data) | - |
679 | { | - |
680 | QGL2PEVectorPathCache *c = (QGL2PEVectorPathCache *) data; never executed (the execution status of this line is deduced): QGL2PEVectorPathCache *c = (QGL2PEVectorPathCache *) data; | - |
681 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
682 | Q_ASSERT(engine->type() == QPaintEngine::OpenGL2); | - |
683 | static_cast<QGL2PaintEngineEx *>(engine)->d_func()->unusedVBOSToClean << c->vbo; | - |
684 | if (c->ibo) | - |
685 | d->unusedIBOSToClean << c->ibo; | - |
686 | #else | - |
687 | Q_UNUSED(engine); never executed (the execution status of this line is deduced): (void)engine;; | - |
688 | free(c->vertices); never executed (the execution status of this line is deduced): free(c->vertices); | - |
689 | free(c->indices); never executed (the execution status of this line is deduced): free(c->indices); | - |
690 | #endif | - |
691 | delete c; never executed (the execution status of this line is deduced): delete c; | - |
692 | } | 0 |
693 | | - |
694 | // Assumes everything is configured for the brush you want to use | - |
695 | void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) | - |
696 | { | - |
697 | transferMode(BrushDrawingMode); never executed (the execution status of this line is deduced): transferMode(BrushDrawingMode); | - |
698 | | - |
699 | if (snapToPixelGrid) { never evaluated: snapToPixelGrid | 0 |
700 | snapToPixelGrid = false; never executed (the execution status of this line is deduced): snapToPixelGrid = false; | - |
701 | matrixDirty = true; never executed (the execution status of this line is deduced): matrixDirty = true; | - |
702 | } | 0 |
703 | | - |
704 | // Might need to call updateMatrix to re-calculate inverseScale | - |
705 | if (matrixDirty) never evaluated: matrixDirty | 0 |
706 | updateMatrix(); never executed: updateMatrix(); | 0 |
707 | | - |
708 | const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); never executed (the execution status of this line is deduced): const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); | - |
709 | | - |
710 | // Check to see if there's any hints | - |
711 | if (path.shape() == QVectorPath::RectangleHint) { never evaluated: path.shape() == QVectorPath::RectangleHint | 0 |
712 | QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y()); never executed (the execution status of this line is deduced): QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y()); | - |
713 | prepareForDraw(currentBrush.isOpaque()); never executed (the execution status of this line is deduced): prepareForDraw(currentBrush.isOpaque()); | - |
714 | composite(rect); never executed (the execution status of this line is deduced): composite(rect); | - |
715 | } else if (path.isConvex()) { never executed: } never evaluated: path.isConvex() | 0 |
716 | | - |
717 | if (path.isCacheable()) { never evaluated: path.isCacheable() | 0 |
718 | QVectorPath::CacheEntry *data = path.lookupCacheData(q); never executed (the execution status of this line is deduced): QVectorPath::CacheEntry *data = path.lookupCacheData(q); | - |
719 | QGL2PEVectorPathCache *cache; never executed (the execution status of this line is deduced): QGL2PEVectorPathCache *cache; | - |
720 | | - |
721 | bool updateCache = false; never executed (the execution status of this line is deduced): bool updateCache = false; | - |
722 | | - |
723 | if (data) { | 0 |
724 | cache = (QGL2PEVectorPathCache *) data->data; never executed (the execution status of this line is deduced): cache = (QGL2PEVectorPathCache *) data->data; | - |
725 | // Check if scale factor is exceeded for curved paths and generate curves if so... | - |
726 | if (path.isCurved()) { never evaluated: path.isCurved() | 0 |
727 | qreal scaleFactor = cache->iscale / inverseScale; never executed (the execution status of this line is deduced): qreal scaleFactor = cache->iscale / inverseScale; | - |
728 | if (scaleFactor < 0.5 || scaleFactor > 2.0) { never evaluated: scaleFactor < 0.5 never evaluated: scaleFactor > 2.0 | 0 |
729 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
730 | glDeleteBuffers(1, &cache->vbo); | - |
731 | cache->vbo = 0; | - |
732 | Q_ASSERT(cache->ibo == 0); | - |
733 | #else | - |
734 | free(cache->vertices); never executed (the execution status of this line is deduced): free(cache->vertices); | - |
735 | Q_ASSERT(cache->indices == 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
736 | #endif | - |
737 | updateCache = true; never executed (the execution status of this line is deduced): updateCache = true; | - |
738 | } | 0 |
739 | } | 0 |
740 | } else { | 0 |
741 | cache = new QGL2PEVectorPathCache; never executed (the execution status of this line is deduced): cache = new QGL2PEVectorPathCache; | - |
742 | data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath); never executed (the execution status of this line is deduced): data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath); | - |
743 | updateCache = true; never executed (the execution status of this line is deduced): updateCache = true; | - |
744 | } | 0 |
745 | | - |
746 | // Flatten the path at the current scale factor and fill it into the cache struct. | - |
747 | if (updateCache) { never evaluated: updateCache | 0 |
748 | vertexCoordinateArray.clear(); never executed (the execution status of this line is deduced): vertexCoordinateArray.clear(); | - |
749 | vertexCoordinateArray.addPath(path, inverseScale, false); never executed (the execution status of this line is deduced): vertexCoordinateArray.addPath(path, inverseScale, false); | - |
750 | int vertexCount = vertexCoordinateArray.vertexCount(); never executed (the execution status of this line is deduced): int vertexCount = vertexCoordinateArray.vertexCount(); | - |
751 | int floatSizeInBytes = vertexCount * 2 * sizeof(float); never executed (the execution status of this line is deduced): int floatSizeInBytes = vertexCount * 2 * sizeof(float); | - |
752 | cache->vertexCount = vertexCount; never executed (the execution status of this line is deduced): cache->vertexCount = vertexCount; | - |
753 | cache->indexCount = 0; never executed (the execution status of this line is deduced): cache->indexCount = 0; | - |
754 | cache->primitiveType = GL_TRIANGLE_FAN; never executed (the execution status of this line is deduced): cache->primitiveType = 0x0006; | - |
755 | cache->iscale = inverseScale; never executed (the execution status of this line is deduced): cache->iscale = inverseScale; | - |
756 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
757 | glGenBuffers(1, &cache->vbo); | - |
758 | glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); | - |
759 | glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW); | - |
760 | cache->ibo = 0; | - |
761 | #else | - |
762 | cache->vertices = (float *) malloc(floatSizeInBytes); never executed (the execution status of this line is deduced): cache->vertices = (float *) malloc(floatSizeInBytes); | - |
763 | memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes); never executed (the execution status of this line is deduced): memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes); | - |
764 | cache->indices = 0; never executed (the execution status of this line is deduced): cache->indices = 0; | - |
765 | #endif | - |
766 | } | 0 |
767 | | - |
768 | prepareForDraw(currentBrush.isOpaque()); never executed (the execution status of this line is deduced): prepareForDraw(currentBrush.isOpaque()); | - |
769 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
770 | glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); | - |
771 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); | - |
772 | #else | - |
773 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); | - |
774 | #endif | - |
775 | glDrawArrays(cache->primitiveType, 0, cache->vertexCount); never executed (the execution status of this line is deduced): glDrawArrays(cache->primitiveType, 0, cache->vertexCount); | - |
776 | | - |
777 | } else { | 0 |
778 | // printf(" - Marking path as cachable...\n"); | - |
779 | // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable | - |
780 | path.makeCacheable(); never executed (the execution status of this line is deduced): path.makeCacheable(); | - |
781 | vertexCoordinateArray.clear(); never executed (the execution status of this line is deduced): vertexCoordinateArray.clear(); | - |
782 | vertexCoordinateArray.addPath(path, inverseScale, false); never executed (the execution status of this line is deduced): vertexCoordinateArray.addPath(path, inverseScale, false); | - |
783 | prepareForDraw(currentBrush.isOpaque()); never executed (the execution status of this line is deduced): prepareForDraw(currentBrush.isOpaque()); | - |
784 | drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); never executed (the execution status of this line is deduced): drawVertexArrays(vertexCoordinateArray, 0x0006); | - |
785 | } | 0 |
786 | | - |
787 | } else { | - |
788 | bool useCache = path.isCacheable(); never executed (the execution status of this line is deduced): bool useCache = path.isCacheable(); | - |
789 | if (useCache) { never evaluated: useCache | 0 |
790 | QRectF bbox = path.controlPointRect(); never executed (the execution status of this line is deduced): QRectF bbox = path.controlPointRect(); | - |
791 | // If the path doesn't fit within these limits, it is possible that the triangulation will fail. | - |
792 | useCache &= (bbox.left() > -0x8000 * inverseScale) never evaluated: (bbox.left() > -0x8000 * inverseScale) | 0 |
793 | && (bbox.right() < 0x8000 * inverseScale) never evaluated: (bbox.right() < 0x8000 * inverseScale) | 0 |
794 | && (bbox.top() > -0x8000 * inverseScale) never evaluated: (bbox.top() > -0x8000 * inverseScale) | 0 |
795 | && (bbox.bottom() < 0x8000 * inverseScale); never evaluated: (bbox.bottom() < 0x8000 * inverseScale) | 0 |
796 | } | 0 |
797 | | - |
798 | if (useCache) { never evaluated: useCache | 0 |
799 | QVectorPath::CacheEntry *data = path.lookupCacheData(q); never executed (the execution status of this line is deduced): QVectorPath::CacheEntry *data = path.lookupCacheData(q); | - |
800 | QGL2PEVectorPathCache *cache; never executed (the execution status of this line is deduced): QGL2PEVectorPathCache *cache; | - |
801 | | - |
802 | bool updateCache = false; never executed (the execution status of this line is deduced): bool updateCache = false; | - |
803 | | - |
804 | if (data) { | 0 |
805 | cache = (QGL2PEVectorPathCache *) data->data; never executed (the execution status of this line is deduced): cache = (QGL2PEVectorPathCache *) data->data; | - |
806 | // Check if scale factor is exceeded for curved paths and generate curves if so... | - |
807 | if (path.isCurved()) { never evaluated: path.isCurved() | 0 |
808 | qreal scaleFactor = cache->iscale / inverseScale; never executed (the execution status of this line is deduced): qreal scaleFactor = cache->iscale / inverseScale; | - |
809 | if (scaleFactor < 0.5 || scaleFactor > 2.0) { never evaluated: scaleFactor < 0.5 never evaluated: scaleFactor > 2.0 | 0 |
810 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
811 | glDeleteBuffers(1, &cache->vbo); | - |
812 | glDeleteBuffers(1, &cache->ibo); | - |
813 | #else | - |
814 | free(cache->vertices); never executed (the execution status of this line is deduced): free(cache->vertices); | - |
815 | free(cache->indices); never executed (the execution status of this line is deduced): free(cache->indices); | - |
816 | #endif | - |
817 | updateCache = true; never executed (the execution status of this line is deduced): updateCache = true; | - |
818 | } | 0 |
819 | } | 0 |
820 | } else { | 0 |
821 | cache = new QGL2PEVectorPathCache; never executed (the execution status of this line is deduced): cache = new QGL2PEVectorPathCache; | - |
822 | data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath); never executed (the execution status of this line is deduced): data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath); | - |
823 | updateCache = true; never executed (the execution status of this line is deduced): updateCache = true; | - |
824 | } | 0 |
825 | | - |
826 | // Flatten the path at the current scale factor and fill it into the cache struct. | - |
827 | if (updateCache) { never evaluated: updateCache | 0 |
828 | QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); never executed (the execution status of this line is deduced): QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); | - |
829 | cache->vertexCount = polys.vertices.size() / 2; never executed (the execution status of this line is deduced): cache->vertexCount = polys.vertices.size() / 2; | - |
830 | cache->indexCount = polys.indices.size(); never executed (the execution status of this line is deduced): cache->indexCount = polys.indices.size(); | - |
831 | cache->primitiveType = GL_TRIANGLES; never executed (the execution status of this line is deduced): cache->primitiveType = 0x0004; | - |
832 | cache->iscale = inverseScale; never executed (the execution status of this line is deduced): cache->iscale = inverseScale; | - |
833 | cache->indexType = polys.indices.type(); never executed (the execution status of this line is deduced): cache->indexType = polys.indices.type(); | - |
834 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
835 | glGenBuffers(1, &cache->vbo); | - |
836 | glGenBuffers(1, &cache->ibo); | - |
837 | glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); | - |
838 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); | - |
839 | | - |
840 | if (polys.indices.type() == QVertexIndexVector::UnsignedInt) | - |
841 | glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); | - |
842 | else | - |
843 | glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint16) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); | - |
844 | | - |
845 | QVarLengthArray<float> vertices(polys.vertices.size()); | - |
846 | for (int i = 0; i < polys.vertices.size(); ++i) | - |
847 | vertices[i] = float(inverseScale * polys.vertices.at(i)); | - |
848 | glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW); | - |
849 | #else | - |
850 | cache->vertices = (float *) malloc(sizeof(float) * polys.vertices.size()); never executed (the execution status of this line is deduced): cache->vertices = (float *) malloc(sizeof(float) * polys.vertices.size()); | - |
851 | if (polys.indices.type() == QVertexIndexVector::UnsignedInt) { never evaluated: polys.indices.type() == QVertexIndexVector::UnsignedInt | 0 |
852 | cache->indices = (quint32 *) malloc(sizeof(quint32) * polys.indices.size()); never executed (the execution status of this line is deduced): cache->indices = (quint32 *) malloc(sizeof(quint32) * polys.indices.size()); | - |
853 | memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size()); never executed (the execution status of this line is deduced): memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size()); | - |
854 | } else { | 0 |
855 | cache->indices = (quint16 *) malloc(sizeof(quint16) * polys.indices.size()); never executed (the execution status of this line is deduced): cache->indices = (quint16 *) malloc(sizeof(quint16) * polys.indices.size()); | - |
856 | memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size()); never executed (the execution status of this line is deduced): memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size()); | - |
857 | } | 0 |
858 | for (int i = 0; i < polys.vertices.size(); ++i) never evaluated: i < polys.vertices.size() | 0 |
859 | cache->vertices[i] = float(inverseScale * polys.vertices.at(i)); never executed: cache->vertices[i] = float(inverseScale * polys.vertices.at(i)); | 0 |
860 | #endif | - |
861 | } | 0 |
862 | | - |
863 | prepareForDraw(currentBrush.isOpaque()); never executed (the execution status of this line is deduced): prepareForDraw(currentBrush.isOpaque()); | - |
864 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
865 | glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); | - |
866 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); | - |
867 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); | - |
868 | if (cache->indexType == QVertexIndexVector::UnsignedInt) | - |
869 | glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0); | - |
870 | else | - |
871 | glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0); | - |
872 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | - |
873 | glBindBuffer(GL_ARRAY_BUFFER, 0); | - |
874 | #else | - |
875 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); | - |
876 | if (cache->indexType == QVertexIndexVector::UnsignedInt) never evaluated: cache->indexType == QVertexIndexVector::UnsignedInt | 0 |
877 | glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices); never executed: glDrawElements(cache->primitiveType, cache->indexCount, 0x1405, (qint32 *)cache->indices); | 0 |
878 | else | - |
879 | glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices); never executed: glDrawElements(cache->primitiveType, cache->indexCount, 0x1403, (qint16 *)cache->indices); | 0 |
880 | #endif | - |
881 | | - |
882 | } else { | - |
883 | // printf(" - Marking path as cachable...\n"); | - |
884 | // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable | - |
885 | path.makeCacheable(); never executed (the execution status of this line is deduced): path.makeCacheable(); | - |
886 | | - |
887 | if (!device->format().stencil()) { never evaluated: !device->format().stencil() | 0 |
888 | // If there is no stencil buffer, triangulate the path instead. | - |
889 | | - |
890 | QRectF bbox = path.controlPointRect(); never executed (the execution status of this line is deduced): QRectF bbox = path.controlPointRect(); | - |
891 | // If the path doesn't fit within these limits, it is possible that the triangulation will fail. | - |
892 | bool withinLimits = (bbox.left() > -0x8000 * inverseScale) never evaluated: (bbox.left() > -0x8000 * inverseScale) | 0 |
893 | && (bbox.right() < 0x8000 * inverseScale) never evaluated: (bbox.right() < 0x8000 * inverseScale) | 0 |
894 | && (bbox.top() > -0x8000 * inverseScale) never evaluated: (bbox.top() > -0x8000 * inverseScale) | 0 |
895 | && (bbox.bottom() < 0x8000 * inverseScale); never evaluated: (bbox.bottom() < 0x8000 * inverseScale) | 0 |
896 | if (withinLimits) { never evaluated: withinLimits | 0 |
897 | QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); never executed (the execution status of this line is deduced): QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); | - |
898 | | - |
899 | QVarLengthArray<float> vertices(polys.vertices.size()); never executed (the execution status of this line is deduced): QVarLengthArray<float> vertices(polys.vertices.size()); | - |
900 | for (int i = 0; i < polys.vertices.size(); ++i) never evaluated: i < polys.vertices.size() | 0 |
901 | vertices[i] = float(inverseScale * polys.vertices.at(i)); never executed: vertices[i] = float(inverseScale * polys.vertices.at(i)); | 0 |
902 | | - |
903 | prepareForDraw(currentBrush.isOpaque()); never executed (the execution status of this line is deduced): prepareForDraw(currentBrush.isOpaque()); | - |
904 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData()); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData()); | - |
905 | if (polys.indices.type() == QVertexIndexVector::UnsignedInt) never evaluated: polys.indices.type() == QVertexIndexVector::UnsignedInt | 0 |
906 | glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data()); never executed: glDrawElements(0x0004, polys.indices.size(), 0x1405, polys.indices.data()); | 0 |
907 | else | - |
908 | glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data()); never executed: glDrawElements(0x0004, polys.indices.size(), 0x1403, polys.indices.data()); | 0 |
909 | } else { | - |
910 | // We can't handle big, concave painter paths with OpenGL without stencil buffer. | - |
911 | qWarning("Painter path exceeds +/-32767 pixels."); never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qpaintengineex_opengl2.cpp", 911, __PRETTY_FUNCTION__).warning("Painter path exceeds +/-32767 pixels."); | - |
912 | } | 0 |
913 | return; | 0 |
914 | } | - |
915 | | - |
916 | // The path is too complicated & needs the stencil technique | - |
917 | vertexCoordinateArray.clear(); never executed (the execution status of this line is deduced): vertexCoordinateArray.clear(); | - |
918 | vertexCoordinateArray.addPath(path, inverseScale, false); never executed (the execution status of this line is deduced): vertexCoordinateArray.addPath(path, inverseScale, false); | - |
919 | | - |
920 | fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); never executed (the execution status of this line is deduced): fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); | - |
921 | | - |
922 | glStencilMask(0xff); never executed (the execution status of this line is deduced): glStencilMask(0xff); | - |
923 | glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x1E01, 0x1E01); | - |
924 | | - |
925 | if (q->state()->clipTestEnabled) { never evaluated: q->state()->clipTestEnabled | 0 |
926 | // Pass when high bit is set, replace stencil value with current clip | - |
927 | glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0205, q->state()->currentClip, GLuint(0x80)); | - |
928 | } else if (path.hasWindingFill()) { never executed: } never evaluated: path.hasWindingFill() | 0 |
929 | // Pass when any bit is set, replace stencil value with 0 | - |
930 | glStencilFunc(GL_NOTEQUAL, 0, 0xff); never executed (the execution status of this line is deduced): glStencilFunc(0x0205, 0, 0xff); | - |
931 | } else { | 0 |
932 | // Pass when high bit is set, replace stencil value with 0 | - |
933 | glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0205, 0, GLuint(0x80)); | - |
934 | } | 0 |
935 | prepareForDraw(currentBrush.isOpaque()); never executed (the execution status of this line is deduced): prepareForDraw(currentBrush.isOpaque()); | - |
936 | | - |
937 | // Stencil the brush onto the dest buffer | - |
938 | composite(vertexCoordinateArray.boundingRect()); never executed (the execution status of this line is deduced): composite(vertexCoordinateArray.boundingRect()); | - |
939 | glStencilMask(0); never executed (the execution status of this line is deduced): glStencilMask(0); | - |
940 | updateClipScissorTest(); never executed (the execution status of this line is deduced): updateClipScissorTest(); | - |
941 | } | 0 |
942 | } | - |
943 | } | - |
944 | | - |
945 | | - |
946 | void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, | - |
947 | int count, | - |
948 | int *stops, | - |
949 | int stopCount, | - |
950 | const QGLRect &bounds, | - |
951 | StencilFillMode mode) | - |
952 | { | - |
953 | Q_ASSERT(count || stops); never executed (the execution status of this line is deduced): qt_noop(); | - |
954 | | - |
955 | // qDebug("QGL2PaintEngineExPrivate::fillStencilWithVertexArray()"); | - |
956 | glStencilMask(0xff); // Enable stencil writes never executed (the execution status of this line is deduced): glStencilMask(0xff); | - |
957 | | - |
958 | if (dirtyStencilRegion.intersects(currentScissorBounds)) { never evaluated: dirtyStencilRegion.intersects(currentScissorBounds) | 0 |
959 | QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); never executed (the execution status of this line is deduced): QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); | - |
960 | glClearStencil(0); // Clear to zero never executed (the execution status of this line is deduced): glClearStencil(0); | - |
961 | for (int i = 0; i < clearRegion.size(); ++i) { never evaluated: i < clearRegion.size() | 0 |
962 | #ifndef QT_GL_NO_SCISSOR_TEST | - |
963 | setScissor(clearRegion.at(i)); never executed (the execution status of this line is deduced): setScissor(clearRegion.at(i)); | - |
964 | #endif | - |
965 | glClear(GL_STENCIL_BUFFER_BIT); never executed (the execution status of this line is deduced): glClear(0x00000400); | - |
966 | } | 0 |
967 | | - |
968 | dirtyStencilRegion -= currentScissorBounds; never executed (the execution status of this line is deduced): dirtyStencilRegion -= currentScissorBounds; | - |
969 | | - |
970 | #ifndef QT_GL_NO_SCISSOR_TEST | - |
971 | updateClipScissorTest(); never executed (the execution status of this line is deduced): updateClipScissorTest(); | - |
972 | #endif | - |
973 | } | 0 |
974 | | - |
975 | glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes never executed (the execution status of this line is deduced): glColorMask(0x0, 0x0, 0x0, 0x0); | - |
976 | useSimpleShader(); never executed (the execution status of this line is deduced): useSimpleShader(); | - |
977 | glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d never executed (the execution status of this line is deduced): glEnable(0x0B90); | - |
978 | | - |
979 | if (mode == WindingFillMode) { never evaluated: mode == WindingFillMode | 0 |
980 | Q_ASSERT(stops && !count); never executed (the execution status of this line is deduced): qt_noop(); | - |
981 | if (q->state()->clipTestEnabled) { never evaluated: q->state()->clipTestEnabled | 0 |
982 | // Flatten clip values higher than current clip, and set high bit to match current clip | - |
983 | glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0203, GLuint(0x80) | q->state()->currentClip, ~GLuint(0x80)); | - |
984 | glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x1E01, 0x1E01); | - |
985 | composite(bounds); never executed (the execution status of this line is deduced): composite(bounds); | - |
986 | | - |
987 | glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0202, GLuint(0x80), GLuint(0x80)); | - |
988 | } else if (!stencilClean) { never executed: } never evaluated: !stencilClean | 0 |
989 | // Clear stencil buffer within bounding rect | - |
990 | glStencilFunc(GL_ALWAYS, 0, 0xff); never executed (the execution status of this line is deduced): glStencilFunc(0x0207, 0, 0xff); | - |
991 | glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); never executed (the execution status of this line is deduced): glStencilOp(0x0, 0x0, 0x0); | - |
992 | composite(bounds); never executed (the execution status of this line is deduced): composite(bounds); | - |
993 | } | 0 |
994 | | - |
995 | // Inc. for front-facing triangle | - |
996 | glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_INCR_WRAP); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glStencilOpSeparate(0x0404, 0x1E00, 0x8507, 0x8507); | - |
997 | // Dec. for back-facing "holes" | - |
998 | glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_DECR_WRAP); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glStencilOpSeparate(0x0405, 0x1E00, 0x8508, 0x8508); | - |
999 | glStencilMask(~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilMask(~GLuint(0x80)); | - |
1000 | drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN); never executed (the execution status of this line is deduced): drawVertexArrays(data, stops, stopCount, 0x0006); | - |
1001 | | - |
1002 | if (q->state()->clipTestEnabled) { never evaluated: q->state()->clipTestEnabled | 0 |
1003 | // Clear high bit of stencil outside of path | - |
1004 | glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0202, q->state()->currentClip, ~GLuint(0x80)); | - |
1005 | glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x1E01, 0x1E01); | - |
1006 | glStencilMask(GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilMask(GLuint(0x80)); | - |
1007 | composite(bounds); never executed (the execution status of this line is deduced): composite(bounds); | - |
1008 | } | 0 |
1009 | } else if (mode == OddEvenFillMode) { never executed: } never evaluated: mode == OddEvenFillMode | 0 |
1010 | glStencilMask(GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilMask(GLuint(0x80)); | - |
1011 | glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x1E00, 0x150A); | - |
1012 | drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN); never executed (the execution status of this line is deduced): drawVertexArrays(data, stops, stopCount, 0x0006); | - |
1013 | | - |
1014 | } else { // TriStripStrokeFillMode | 0 |
1015 | Q_ASSERT(count && !stops); // tristrips generated directly, so no vertexArray or stops never executed (the execution status of this line is deduced): qt_noop(); | - |
1016 | glStencilMask(GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilMask(GLuint(0x80)); | - |
1017 | #if 0 | - |
1018 | glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit | - |
1019 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); | - |
1020 | glDrawArrays(GL_TRIANGLE_STRIP, 0, count); | - |
1021 | #else | - |
1022 | | - |
1023 | glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x1E00, 0x1E01); | - |
1024 | if (q->state()->clipTestEnabled) { never evaluated: q->state()->clipTestEnabled | 0 |
1025 | glStencilFunc(GL_LEQUAL, q->state()->currentClip | GL_STENCIL_HIGH_BIT, never executed (the execution status of this line is deduced): glStencilFunc(0x0203, q->state()->currentClip | GLuint(0x80), | - |
1026 | ~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): ~GLuint(0x80)); | - |
1027 | } else { | 0 |
1028 | glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff); never executed (the execution status of this line is deduced): glStencilFunc(0x0207, GLuint(0x80), 0xff); | - |
1029 | } | 0 |
1030 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); | - |
1031 | glDrawArrays(GL_TRIANGLE_STRIP, 0, count); never executed (the execution status of this line is deduced): glDrawArrays(0x0005, 0, count); | - |
1032 | #endif | - |
1033 | } | 0 |
1034 | | - |
1035 | // Enable color writes & disable stencil writes | - |
1036 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); never executed (the execution status of this line is deduced): glColorMask(0x1, 0x1, 0x1, 0x1); | - |
1037 | } | 0 |
1038 | | - |
1039 | /* | - |
1040 | If the maximum value in the stencil buffer is GL_STENCIL_HIGH_BIT - 1, | - |
1041 | restore the stencil buffer to a pristine state. The current clip region | - |
1042 | is set to 1, and the rest to 0. | - |
1043 | */ | - |
1044 | void QGL2PaintEngineExPrivate::resetClipIfNeeded() | - |
1045 | { | - |
1046 | if (maxClip != (GL_STENCIL_HIGH_BIT - 1)) never evaluated: maxClip != (GLuint(0x80) - 1) | 0 |
1047 | return; | 0 |
1048 | | - |
1049 | Q_Q(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineEx * const q = q_func(); | - |
1050 | | - |
1051 | useSimpleShader(); never executed (the execution status of this line is deduced): useSimpleShader(); | - |
1052 | glEnable(GL_STENCIL_TEST); never executed (the execution status of this line is deduced): glEnable(0x0B90); | - |
1053 | glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); never executed (the execution status of this line is deduced): glColorMask(0x0, 0x0, 0x0, 0x0); | - |
1054 | | - |
1055 | QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height)); never executed (the execution status of this line is deduced): QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height)); | - |
1056 | QGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom()); never executed (the execution status of this line is deduced): QGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom()); | - |
1057 | | - |
1058 | // Set high bit on clip region | - |
1059 | glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff); never executed (the execution status of this line is deduced): glStencilFunc(0x0203, q->state()->currentClip, 0xff); | - |
1060 | glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x150A, 0x150A); | - |
1061 | glStencilMask(GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilMask(GLuint(0x80)); | - |
1062 | composite(rect); never executed (the execution status of this line is deduced): composite(rect); | - |
1063 | | - |
1064 | // Reset clipping to 1 and everything else to zero | - |
1065 | glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0205, 0x01, GLuint(0x80)); | - |
1066 | glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE); never executed (the execution status of this line is deduced): glStencilOp(0x0, 0x1E01, 0x1E01); | - |
1067 | glStencilMask(0xff); never executed (the execution status of this line is deduced): glStencilMask(0xff); | - |
1068 | composite(rect); never executed (the execution status of this line is deduced): composite(rect); | - |
1069 | | - |
1070 | q->state()->currentClip = 1; never executed (the execution status of this line is deduced): q->state()->currentClip = 1; | - |
1071 | q->state()->canRestoreClip = false; never executed (the execution status of this line is deduced): q->state()->canRestoreClip = false; | - |
1072 | | - |
1073 | maxClip = 1; never executed (the execution status of this line is deduced): maxClip = 1; | - |
1074 | | - |
1075 | glStencilMask(0x0); never executed (the execution status of this line is deduced): glStencilMask(0x0); | - |
1076 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); never executed (the execution status of this line is deduced): glColorMask(0x1, 0x1, 0x1, 0x1); | - |
1077 | } | 0 |
1078 | | - |
1079 | bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) | - |
1080 | { | - |
1081 | if (brushTextureDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode) never evaluated: brushTextureDirty never evaluated: mode != ImageDrawingMode never evaluated: mode != ImageArrayDrawingMode | 0 |
1082 | updateBrushTexture(); never executed: updateBrushTexture(); | 0 |
1083 | | - |
1084 | if (compositionModeDirty) never evaluated: compositionModeDirty | 0 |
1085 | updateCompositionMode(); never executed: updateCompositionMode(); | 0 |
1086 | | - |
1087 | if (matrixDirty) never evaluated: matrixDirty | 0 |
1088 | updateMatrix(); never executed: updateMatrix(); | 0 |
1089 | | - |
1090 | const bool stateHasOpacity = q->state()->opacity < 0.99f; never executed (the execution status of this line is deduced): const bool stateHasOpacity = q->state()->opacity < 0.99f; | - |
1091 | if (q->state()->composition_mode == QPainter::CompositionMode_Source never evaluated: q->state()->composition_mode == QPainter::CompositionMode_Source | 0 |
1092 | || (q->state()->composition_mode == QPainter::CompositionMode_SourceOver never evaluated: q->state()->composition_mode == QPainter::CompositionMode_SourceOver | 0 |
1093 | && srcPixelsAreOpaque && !stateHasOpacity)) never evaluated: srcPixelsAreOpaque never evaluated: !stateHasOpacity | 0 |
1094 | { | - |
1095 | glDisable(GL_BLEND); never executed (the execution status of this line is deduced): glDisable(0x0BE2); | - |
1096 | } else { | 0 |
1097 | glEnable(GL_BLEND); never executed (the execution status of this line is deduced): glEnable(0x0BE2); | - |
1098 | } | 0 |
1099 | | - |
1100 | QGLEngineShaderManager::OpacityMode opacityMode; never executed (the execution status of this line is deduced): QGLEngineShaderManager::OpacityMode opacityMode; | - |
1101 | if (mode == ImageArrayDrawingMode) { never evaluated: mode == ImageArrayDrawingMode | 0 |
1102 | opacityMode = QGLEngineShaderManager::AttributeOpacity; never executed (the execution status of this line is deduced): opacityMode = QGLEngineShaderManager::AttributeOpacity; | - |
1103 | } else { | 0 |
1104 | opacityMode = stateHasOpacity ? QGLEngineShaderManager::UniformOpacity never evaluated: stateHasOpacity | 0 |
1105 | : QGLEngineShaderManager::NoOpacity; never executed (the execution status of this line is deduced): : QGLEngineShaderManager::NoOpacity; | - |
1106 | if (stateHasOpacity && (mode != ImageDrawingMode)) { never evaluated: stateHasOpacity never evaluated: (mode != ImageDrawingMode) | 0 |
1107 | // Using a brush | - |
1108 | bool brushIsPattern = (currentBrush.style() >= Qt::Dense1Pattern) && never evaluated: (currentBrush.style() >= Qt::Dense1Pattern) | 0 |
1109 | (currentBrush.style() <= Qt::DiagCrossPattern); never evaluated: (currentBrush.style() <= Qt::DiagCrossPattern) | 0 |
1110 | | - |
1111 | if ((currentBrush.style() == Qt::SolidPattern) || brushIsPattern) never evaluated: (currentBrush.style() == Qt::SolidPattern) never evaluated: brushIsPattern | 0 |
1112 | opacityMode = QGLEngineShaderManager::NoOpacity; // Global opacity handled by srcPixel shader never executed: opacityMode = QGLEngineShaderManager::NoOpacity; | 0 |
1113 | } | 0 |
1114 | } | 0 |
1115 | shaderManager->setOpacityMode(opacityMode); never executed (the execution status of this line is deduced): shaderManager->setOpacityMode(opacityMode); | - |
1116 | | - |
1117 | bool changed = shaderManager->useCorrectShaderProg(); never executed (the execution status of this line is deduced): bool changed = shaderManager->useCorrectShaderProg(); | - |
1118 | // If the shader program needs changing, we change it and mark all uniforms as dirty | - |
1119 | if (changed) { | 0 |
1120 | // The shader program has changed so mark all uniforms as dirty: | - |
1121 | brushUniformsDirty = true; never executed (the execution status of this line is deduced): brushUniformsDirty = true; | - |
1122 | opacityUniformDirty = true; never executed (the execution status of this line is deduced): opacityUniformDirty = true; | - |
1123 | matrixUniformDirty = true; never executed (the execution status of this line is deduced): matrixUniformDirty = true; | - |
1124 | } | 0 |
1125 | | - |
1126 | if (brushUniformsDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode) never evaluated: brushUniformsDirty never evaluated: mode != ImageDrawingMode never evaluated: mode != ImageArrayDrawingMode | 0 |
1127 | updateBrushUniforms(); never executed: updateBrushUniforms(); | 0 |
1128 | | - |
1129 | if (opacityMode == QGLEngineShaderManager::UniformOpacity && opacityUniformDirty) { never evaluated: opacityMode == QGLEngineShaderManager::UniformOpacity never evaluated: opacityUniformDirty | 0 |
1130 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity); | - |
1131 | opacityUniformDirty = false; never executed (the execution status of this line is deduced): opacityUniformDirty = false; | - |
1132 | } | 0 |
1133 | | - |
1134 | if (matrixUniformDirty && shaderManager->hasComplexGeometry()) { never evaluated: matrixUniformDirty never evaluated: shaderManager->hasComplexGeometry() | 0 |
1135 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Matrix), never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Matrix), | - |
1136 | pmvMatrix); never executed (the execution status of this line is deduced): pmvMatrix); | - |
1137 | matrixUniformDirty = false; never executed (the execution status of this line is deduced): matrixUniformDirty = false; | - |
1138 | } | 0 |
1139 | | - |
1140 | return changed; never executed: return changed; | 0 |
1141 | } | - |
1142 | | - |
1143 | void QGL2PaintEngineExPrivate::composite(const QGLRect& boundingRect) | - |
1144 | { | - |
1145 | setCoords(staticVertexCoordinateArray, boundingRect); never executed (the execution status of this line is deduced): setCoords(staticVertexCoordinateArray, boundingRect); | - |
1146 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); | - |
1147 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); never executed (the execution status of this line is deduced): glDrawArrays(0x0006, 0, 4); | - |
1148 | } | 0 |
1149 | | - |
1150 | // Draws the vertex array as a set of <vertexArrayStops.size()> triangle fans. | - |
1151 | void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, int stopCount, | - |
1152 | GLenum primitive) | - |
1153 | { | - |
1154 | // Now setup the pointer to the vertex array: | - |
1155 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)data); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)data); | - |
1156 | | - |
1157 | int previousStop = 0; never executed (the execution status of this line is deduced): int previousStop = 0; | - |
1158 | for (int i=0; i<stopCount; ++i) { never evaluated: i<stopCount | 0 |
1159 | int stop = stops[i]; never executed (the execution status of this line is deduced): int stop = stops[i]; | - |
1160 | /* | - |
1161 | qDebug("Drawing triangle fan for vertecies %d -> %d:", previousStop, stop-1); | - |
1162 | for (int i=previousStop; i<stop; ++i) | - |
1163 | qDebug(" %02d: [%.2f, %.2f]", i, vertexArray.data()[i].x, vertexArray.data()[i].y); | - |
1164 | */ | - |
1165 | glDrawArrays(primitive, previousStop, stop - previousStop); never executed (the execution status of this line is deduced): glDrawArrays(primitive, previousStop, stop - previousStop); | - |
1166 | previousStop = stop; never executed (the execution status of this line is deduced): previousStop = stop; | - |
1167 | } | 0 |
1168 | } | 0 |
1169 | | - |
1170 | /////////////////////////////////// Public Methods ////////////////////////////////////////// | - |
1171 | | - |
1172 | QGL2PaintEngineEx::QGL2PaintEngineEx() | - |
1173 | : QPaintEngineEx(*(new QGL2PaintEngineExPrivate(this))) | - |
1174 | { | - |
1175 | } | 0 |
1176 | | - |
1177 | QGL2PaintEngineEx::~QGL2PaintEngineEx() | - |
1178 | { | - |
1179 | } | - |
1180 | | - |
1181 | void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) | - |
1182 | { | - |
1183 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1184 | | - |
1185 | if (qbrush_style(brush) == Qt::NoBrush) never evaluated: qbrush_style(brush) == Qt::NoBrush | 0 |
1186 | return; | 0 |
1187 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
1188 | d->setBrush(brush); never executed (the execution status of this line is deduced): d->setBrush(brush); | - |
1189 | d->fill(path); never executed (the execution status of this line is deduced): d->fill(path); | - |
1190 | } | 0 |
1191 | | - |
1192 | Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp | - |
1193 | | - |
1194 | | - |
1195 | void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) | - |
1196 | { | - |
1197 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1198 | | - |
1199 | const QBrush &penBrush = qpen_brush(pen); never executed (the execution status of this line is deduced): const QBrush &penBrush = qpen_brush(pen); | - |
1200 | if (qpen_style(pen) == Qt::NoPen || qbrush_style(penBrush) == Qt::NoBrush) never evaluated: qpen_style(pen) == Qt::NoPen never evaluated: qbrush_style(penBrush) == Qt::NoBrush | 0 |
1201 | return; | 0 |
1202 | | - |
1203 | QOpenGL2PaintEngineState *s = state(); never executed (the execution status of this line is deduced): QOpenGL2PaintEngineState *s = state(); | - |
1204 | if (qt_pen_is_cosmetic(pen, s->renderHints) && !qt_scaleForTransform(s->transform(), 0)) { never evaluated: qt_pen_is_cosmetic(pen, s->renderHints) never evaluated: !qt_scaleForTransform(s->transform(), 0) | 0 |
1205 | // QTriangulatingStroker class is not meant to support cosmetically sheared strokes. | - |
1206 | QPaintEngineEx::stroke(path, pen); never executed (the execution status of this line is deduced): QPaintEngineEx::stroke(path, pen); | - |
1207 | return; | 0 |
1208 | } | - |
1209 | | - |
1210 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
1211 | d->setBrush(penBrush); never executed (the execution status of this line is deduced): d->setBrush(penBrush); | - |
1212 | d->stroke(path, pen); never executed (the execution status of this line is deduced): d->stroke(path, pen); | - |
1213 | } | 0 |
1214 | | - |
1215 | void QGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &pen) | - |
1216 | { | - |
1217 | const QOpenGL2PaintEngineState *s = q->state(); never executed (the execution status of this line is deduced): const QOpenGL2PaintEngineState *s = q->state(); | - |
1218 | if (snapToPixelGrid) { never evaluated: snapToPixelGrid | 0 |
1219 | snapToPixelGrid = false; never executed (the execution status of this line is deduced): snapToPixelGrid = false; | - |
1220 | matrixDirty = true; never executed (the execution status of this line is deduced): matrixDirty = true; | - |
1221 | } | 0 |
1222 | | - |
1223 | const Qt::PenStyle penStyle = qpen_style(pen); never executed (the execution status of this line is deduced): const Qt::PenStyle penStyle = qpen_style(pen); | - |
1224 | const QBrush &penBrush = qpen_brush(pen); never executed (the execution status of this line is deduced): const QBrush &penBrush = qpen_brush(pen); | - |
1225 | const bool opaque = penBrush.isOpaque() && s->opacity > 0.99; never evaluated: penBrush.isOpaque() never evaluated: s->opacity > 0.99 | 0 |
1226 | | - |
1227 | transferMode(BrushDrawingMode); never executed (the execution status of this line is deduced): transferMode(BrushDrawingMode); | - |
1228 | | - |
1229 | // updateMatrix() is responsible for setting the inverse scale on | - |
1230 | // the strokers, so we need to call it here and not wait for | - |
1231 | // prepareForDraw() down below. | - |
1232 | updateMatrix(); never executed (the execution status of this line is deduced): updateMatrix(); | - |
1233 | | - |
1234 | QRectF clip = q->state()->matrix.inverted().mapRect(q->state()->clipEnabled never executed (the execution status of this line is deduced): QRectF clip = q->state()->matrix.inverted().mapRect(q->state()->clipEnabled | - |
1235 | ? q->state()->rectangleClip never executed (the execution status of this line is deduced): ? q->state()->rectangleClip | - |
1236 | : QRectF(0, 0, width, height)); never executed (the execution status of this line is deduced): : QRectF(0, 0, width, height)); | - |
1237 | | - |
1238 | if (penStyle == Qt::SolidLine) { never evaluated: penStyle == Qt::SolidLine | 0 |
1239 | stroker.process(path, pen, clip, s->renderHints); never executed (the execution status of this line is deduced): stroker.process(path, pen, clip, s->renderHints); | - |
1240 | | - |
1241 | } else { // Some sort of dash | 0 |
1242 | dasher.process(path, pen, clip, s->renderHints); never executed (the execution status of this line is deduced): dasher.process(path, pen, clip, s->renderHints); | - |
1243 | | - |
1244 | QVectorPath dashStroke(dasher.points(), never executed (the execution status of this line is deduced): QVectorPath dashStroke(dasher.points(), | - |
1245 | dasher.elementCount(), never executed (the execution status of this line is deduced): dasher.elementCount(), | - |
1246 | dasher.elementTypes()); never executed (the execution status of this line is deduced): dasher.elementTypes()); | - |
1247 | stroker.process(dashStroke, pen, clip, s->renderHints); never executed (the execution status of this line is deduced): stroker.process(dashStroke, pen, clip, s->renderHints); | - |
1248 | } | 0 |
1249 | | - |
1250 | if (!stroker.vertexCount()) never evaluated: !stroker.vertexCount() | 0 |
1251 | return; | 0 |
1252 | | - |
1253 | if (opaque) { | 0 |
1254 | prepareForDraw(opaque); never executed (the execution status of this line is deduced): prepareForDraw(opaque); | - |
1255 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices()); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices()); | - |
1256 | glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2); never executed (the execution status of this line is deduced): glDrawArrays(0x0005, 0, stroker.vertexCount() / 2); | - |
1257 | | - |
1258 | // QBrush b(Qt::green); | - |
1259 | // d->setBrush(&b); | - |
1260 | // d->prepareForDraw(true); | - |
1261 | // glDrawArrays(GL_LINE_STRIP, 0, d->stroker.vertexCount() / 2); | - |
1262 | | - |
1263 | } else { | 0 |
1264 | qreal width = qpen_widthf(pen) / 2; never executed (the execution status of this line is deduced): qreal width = qpen_widthf(pen) / 2; | - |
1265 | if (width == 0) never evaluated: width == 0 | 0 |
1266 | width = 0.5; never executed: width = 0.5; | 0 |
1267 | qreal extra = pen.joinStyle() == Qt::MiterJoin never evaluated: pen.joinStyle() == Qt::MiterJoin | 0 |
1268 | ? qMax(pen.miterLimit() * width, width) never executed (the execution status of this line is deduced): ? qMax(pen.miterLimit() * width, width) | - |
1269 | : width; never executed (the execution status of this line is deduced): : width; | - |
1270 | | - |
1271 | if (qt_pen_is_cosmetic(pen, s->renderHints)) never evaluated: qt_pen_is_cosmetic(pen, s->renderHints) | 0 |
1272 | extra = extra * inverseScale; never executed: extra = extra * inverseScale; | 0 |
1273 | | - |
1274 | QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra); never executed (the execution status of this line is deduced): QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra); | - |
1275 | | - |
1276 | fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2, never executed (the execution status of this line is deduced): fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2, | - |
1277 | 0, 0, bounds, QGL2PaintEngineExPrivate::TriStripStrokeFillMode); never executed (the execution status of this line is deduced): 0, 0, bounds, QGL2PaintEngineExPrivate::TriStripStrokeFillMode); | - |
1278 | | - |
1279 | glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x1E01, 0x1E01); | - |
1280 | | - |
1281 | // Pass when any bit is set, replace stencil value with 0 | - |
1282 | glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0205, 0, GLuint(0x80)); | - |
1283 | prepareForDraw(false); never executed (the execution status of this line is deduced): prepareForDraw(false); | - |
1284 | | - |
1285 | // Stencil the brush onto the dest buffer | - |
1286 | composite(bounds); never executed (the execution status of this line is deduced): composite(bounds); | - |
1287 | | - |
1288 | glStencilMask(0); never executed (the execution status of this line is deduced): glStencilMask(0); | - |
1289 | | - |
1290 | updateClipScissorTest(); never executed (the execution status of this line is deduced): updateClipScissorTest(); | - |
1291 | } | 0 |
1292 | } | - |
1293 | | - |
1294 | void QGL2PaintEngineEx::penChanged() { } | - |
1295 | void QGL2PaintEngineEx::brushChanged() { } | - |
1296 | void QGL2PaintEngineEx::brushOriginChanged() { } | - |
1297 | | - |
1298 | void QGL2PaintEngineEx::opacityChanged() | - |
1299 | { | - |
1300 | // qDebug("QGL2PaintEngineEx::opacityChanged()"); | - |
1301 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1302 | state()->opacityChanged = true; never executed (the execution status of this line is deduced): state()->opacityChanged = true; | - |
1303 | | - |
1304 | Q_ASSERT(d->shaderManager); never executed (the execution status of this line is deduced): qt_noop(); | - |
1305 | d->brushUniformsDirty = true; never executed (the execution status of this line is deduced): d->brushUniformsDirty = true; | - |
1306 | d->opacityUniformDirty = true; never executed (the execution status of this line is deduced): d->opacityUniformDirty = true; | - |
1307 | } | 0 |
1308 | | - |
1309 | void QGL2PaintEngineEx::compositionModeChanged() | - |
1310 | { | - |
1311 | // qDebug("QGL2PaintEngineEx::compositionModeChanged()"); | - |
1312 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1313 | state()->compositionModeChanged = true; never executed (the execution status of this line is deduced): state()->compositionModeChanged = true; | - |
1314 | d->compositionModeDirty = true; never executed (the execution status of this line is deduced): d->compositionModeDirty = true; | - |
1315 | } | 0 |
1316 | | - |
1317 | void QGL2PaintEngineEx::renderHintsChanged() | - |
1318 | { | - |
1319 | state()->renderHintsChanged = true; never executed (the execution status of this line is deduced): state()->renderHintsChanged = true; | - |
1320 | | - |
1321 | #if !defined(QT_OPENGL_ES_2) | - |
1322 | if ((state()->renderHints & QPainter::Antialiasing) never evaluated: (state()->renderHints & QPainter::Antialiasing) | 0 |
1323 | || (state()->renderHints & QPainter::HighQualityAntialiasing)) never evaluated: (state()->renderHints & QPainter::HighQualityAntialiasing) | 0 |
1324 | glEnable(GL_MULTISAMPLE); never executed: glEnable(0x809D); | 0 |
1325 | else | - |
1326 | glDisable(GL_MULTISAMPLE); never executed: glDisable(0x809D); | 0 |
1327 | #endif | - |
1328 | | - |
1329 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1330 | d->lastTextureUsed = GLuint(-1); never executed (the execution status of this line is deduced): d->lastTextureUsed = GLuint(-1); | - |
1331 | d->brushTextureDirty = true; never executed (the execution status of this line is deduced): d->brushTextureDirty = true; | - |
1332 | // qDebug("QGL2PaintEngineEx::renderHintsChanged() not implemented!"); | - |
1333 | } | 0 |
1334 | | - |
1335 | void QGL2PaintEngineEx::transformChanged() | - |
1336 | { | - |
1337 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1338 | d->matrixDirty = true; never executed (the execution status of this line is deduced): d->matrixDirty = true; | - |
1339 | state()->matrixChanged = true; never executed (the execution status of this line is deduced): state()->matrixChanged = true; | - |
1340 | } | 0 |
1341 | | - |
1342 | | - |
1343 | static const QRectF scaleRect(const QRectF &r, qreal sx, qreal sy) | - |
1344 | { | - |
1345 | return QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy); never executed: return QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy); | 0 |
1346 | } | - |
1347 | | - |
1348 | void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, const QRectF & src) | - |
1349 | { | - |
1350 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1351 | QGLContext *ctx = d->ctx; never executed (the execution status of this line is deduced): QGLContext *ctx = d->ctx; | - |
1352 | | - |
1353 | int max_texture_size = ctx->d_func()->maxTextureSize(); never executed (the execution status of this line is deduced): int max_texture_size = ctx->d_func()->maxTextureSize(); | - |
1354 | if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) { never evaluated: pixmap.width() > max_texture_size never evaluated: pixmap.height() > max_texture_size | 0 |
1355 | QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); never executed (the execution status of this line is deduced): QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); | - |
1356 | | - |
1357 | const qreal sx = scaled.width() / qreal(pixmap.width()); never executed (the execution status of this line is deduced): const qreal sx = scaled.width() / qreal(pixmap.width()); | - |
1358 | const qreal sy = scaled.height() / qreal(pixmap.height()); never executed (the execution status of this line is deduced): const qreal sy = scaled.height() / qreal(pixmap.height()); | - |
1359 | | - |
1360 | drawPixmap(dest, scaled, scaleRect(src, sx, sy)); never executed (the execution status of this line is deduced): drawPixmap(dest, scaled, scaleRect(src, sx, sy)); | - |
1361 | return; | 0 |
1362 | } | - |
1363 | | - |
1364 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
1365 | d->transferMode(ImageDrawingMode); never executed (the execution status of this line is deduced): d->transferMode(ImageDrawingMode); | - |
1366 | | - |
1367 | QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption|QGLContext::CanFlipNativePixmapBindOption; never executed (the execution status of this line is deduced): QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption|QGLContext::CanFlipNativePixmapBindOption; | - |
1368 | #ifdef QGL_USE_TEXTURE_POOL | - |
1369 | bindOptions |= QGLContext::TemporarilyCachedBindOption; | - |
1370 | #endif | - |
1371 | | - |
1372 | glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(0)); | - |
1373 | QGLTexture *texture = never executed (the execution status of this line is deduced): QGLTexture *texture = | - |
1374 | ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, bindOptions); never executed (the execution status of this line is deduced): ctx->d_func()->bindTexture(pixmap, 0x0DE1, 0x1908, bindOptions); | - |
1375 | | - |
1376 | GLfloat top = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.top()) : src.top(); never evaluated: texture->options & QGLContext::InvertedYBindOption | 0 |
1377 | GLfloat bottom = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.bottom()) : src.bottom(); never evaluated: texture->options & QGLContext::InvertedYBindOption | 0 |
1378 | QGLRect srcRect(src.left(), top, src.right(), bottom); never executed (the execution status of this line is deduced): QGLRect srcRect(src.left(), top, src.right(), bottom); | - |
1379 | | - |
1380 | bool isBitmap = pixmap.isQBitmap(); never executed (the execution status of this line is deduced): bool isBitmap = pixmap.isQBitmap(); | - |
1381 | bool isOpaque = !isBitmap && !pixmap.hasAlpha(); never evaluated: !isBitmap never evaluated: !pixmap.hasAlpha() | 0 |
1382 | | - |
1383 | d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, never executed (the execution status of this line is deduced): d->updateTextureFilter(0x0DE1, 0x812F, | - |
1384 | state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); never executed (the execution status of this line is deduced): state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); | - |
1385 | d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap); never executed (the execution status of this line is deduced): d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap); | - |
1386 | | - |
1387 | if (texture->options&QGLContext::TemporarilyCachedBindOption) { never evaluated: texture->options&QGLContext::TemporarilyCachedBindOption | 0 |
1388 | // pixmap was temporarily cached as a QImage texture by pooling system | - |
1389 | // and should be destroyed immediately | - |
1390 | QGLTextureCache::instance()->remove(ctx, texture->id); never executed (the execution status of this line is deduced): QGLTextureCache::instance()->remove(ctx, texture->id); | - |
1391 | } | 0 |
1392 | } | 0 |
1393 | | - |
1394 | void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QRectF& src, | - |
1395 | Qt::ImageConversionFlags) | - |
1396 | { | - |
1397 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1398 | QGLContext *ctx = d->ctx; never executed (the execution status of this line is deduced): QGLContext *ctx = d->ctx; | - |
1399 | | - |
1400 | int max_texture_size = ctx->d_func()->maxTextureSize(); never executed (the execution status of this line is deduced): int max_texture_size = ctx->d_func()->maxTextureSize(); | - |
1401 | if (image.width() > max_texture_size || image.height() > max_texture_size) { never evaluated: image.width() > max_texture_size never evaluated: image.height() > max_texture_size | 0 |
1402 | QImage scaled = image.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); never executed (the execution status of this line is deduced): QImage scaled = image.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); | - |
1403 | | - |
1404 | const qreal sx = scaled.width() / qreal(image.width()); never executed (the execution status of this line is deduced): const qreal sx = scaled.width() / qreal(image.width()); | - |
1405 | const qreal sy = scaled.height() / qreal(image.height()); never executed (the execution status of this line is deduced): const qreal sy = scaled.height() / qreal(image.height()); | - |
1406 | | - |
1407 | drawImage(dest, scaled, scaleRect(src, sx, sy)); never executed (the execution status of this line is deduced): drawImage(dest, scaled, scaleRect(src, sx, sy)); | - |
1408 | return; | 0 |
1409 | } | - |
1410 | | - |
1411 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
1412 | d->transferMode(ImageDrawingMode); never executed (the execution status of this line is deduced): d->transferMode(ImageDrawingMode); | - |
1413 | | - |
1414 | glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(0)); | - |
1415 | | - |
1416 | QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption; never executed (the execution status of this line is deduced): QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption; | - |
1417 | #ifdef QGL_USE_TEXTURE_POOL | - |
1418 | bindOptions |= QGLContext::TemporarilyCachedBindOption; | - |
1419 | #endif | - |
1420 | | - |
1421 | QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, bindOptions); never executed (the execution status of this line is deduced): QGLTexture *texture = ctx->d_func()->bindTexture(image, 0x0DE1, 0x1908, bindOptions); | - |
1422 | GLuint id = texture->id; never executed (the execution status of this line is deduced): GLuint id = texture->id; | - |
1423 | | - |
1424 | d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, never executed (the execution status of this line is deduced): d->updateTextureFilter(0x0DE1, 0x812F, | - |
1425 | state()->renderHints & QPainter::SmoothPixmapTransform, id); never executed (the execution status of this line is deduced): state()->renderHints & QPainter::SmoothPixmapTransform, id); | - |
1426 | d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel()); never executed (the execution status of this line is deduced): d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel()); | - |
1427 | | - |
1428 | if (texture->options&QGLContext::TemporarilyCachedBindOption) { never evaluated: texture->options&QGLContext::TemporarilyCachedBindOption | 0 |
1429 | // image was temporarily cached by texture pooling system | - |
1430 | // and should be destroyed immediately | - |
1431 | QGLTextureCache::instance()->remove(ctx, texture->id); never executed (the execution status of this line is deduced): QGLTextureCache::instance()->remove(ctx, texture->id); | - |
1432 | } | 0 |
1433 | } | 0 |
1434 | | - |
1435 | void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) | - |
1436 | { | - |
1437 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1438 | | - |
1439 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
1440 | | - |
1441 | QPainterState *s = state(); never executed (the execution status of this line is deduced): QPainterState *s = state(); | - |
1442 | float det = s->matrix.determinant(); never executed (the execution status of this line is deduced): float det = s->matrix.determinant(); | - |
1443 | | - |
1444 | // don't try to cache huge fonts or vastly transformed fonts | - |
1445 | QFontEngine *fontEngine = textItem->fontEngine(); never executed (the execution status of this line is deduced): QFontEngine *fontEngine = textItem->fontEngine(); | - |
1446 | if (shouldDrawCachedGlyphs(fontEngine, s->matrix) && det >= 0.25f && det <= 4.f) { never evaluated: shouldDrawCachedGlyphs(fontEngine, s->matrix) never evaluated: det >= 0.25f never evaluated: det <= 4.f | 0 |
1447 | QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 never evaluated: fontEngine->glyphFormat >= 0 | 0 |
1448 | ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat) never executed (the execution status of this line is deduced): ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat) | - |
1449 | : d->glyphCacheType; never executed (the execution status of this line is deduced): : d->glyphCacheType; | - |
1450 | if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { never evaluated: glyphType == QFontEngineGlyphCache::Raster_RGBMask | 0 |
1451 | if (!QGLFramebufferObject::hasOpenGLFramebufferObjects() never evaluated: !QGLFramebufferObject::hasOpenGLFramebufferObjects() | 0 |
1452 | || d->device->alphaRequested() || s->matrix.type() > QTransform::TxTranslate never evaluated: d->device->alphaRequested() never evaluated: s->matrix.type() > QTransform::TxTranslate | 0 |
1453 | || (s->composition_mode != QPainter::CompositionMode_Source never evaluated: s->composition_mode != QPainter::CompositionMode_Source | 0 |
1454 | && s->composition_mode != QPainter::CompositionMode_SourceOver)) never evaluated: s->composition_mode != QPainter::CompositionMode_SourceOver | 0 |
1455 | { | - |
1456 | glyphType = QFontEngineGlyphCache::Raster_A8; never executed (the execution status of this line is deduced): glyphType = QFontEngineGlyphCache::Raster_A8; | - |
1457 | } | 0 |
1458 | } | 0 |
1459 | | - |
1460 | d->drawCachedGlyphs(glyphType, textItem); never executed (the execution status of this line is deduced): d->drawCachedGlyphs(glyphType, textItem); | - |
1461 | } else { | 0 |
1462 | QPaintEngineEx::drawStaticTextItem(textItem); never executed (the execution status of this line is deduced): QPaintEngineEx::drawStaticTextItem(textItem); | - |
1463 | } | 0 |
1464 | } | - |
1465 | | - |
1466 | bool QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src) | - |
1467 | { | - |
1468 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1469 | if (!d->shaderManager) never evaluated: !d->shaderManager | 0 |
1470 | return false; never executed: return false; | 0 |
1471 | | - |
1472 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
1473 | d->transferMode(ImageDrawingMode); never executed (the execution status of this line is deduced): d->transferMode(ImageDrawingMode); | - |
1474 | | - |
1475 | #ifndef QT_OPENGL_ES_2 | - |
1476 | QGLContext *ctx = d->ctx; never executed (the execution status of this line is deduced): QGLContext *ctx = d->ctx; | - |
1477 | #endif | - |
1478 | glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(0)); | - |
1479 | glBindTexture(GL_TEXTURE_2D, textureId); never executed (the execution status of this line is deduced): glBindTexture(0x0DE1, textureId); | - |
1480 | | - |
1481 | QGLRect srcRect(src.left(), src.bottom(), src.right(), src.top()); never executed (the execution status of this line is deduced): QGLRect srcRect(src.left(), src.bottom(), src.right(), src.top()); | - |
1482 | | - |
1483 | d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, never executed (the execution status of this line is deduced): d->updateTextureFilter(0x0DE1, 0x812F, | - |
1484 | state()->renderHints & QPainter::SmoothPixmapTransform, textureId); never executed (the execution status of this line is deduced): state()->renderHints & QPainter::SmoothPixmapTransform, textureId); | - |
1485 | d->drawTexture(dest, srcRect, size, false); never executed (the execution status of this line is deduced): d->drawTexture(dest, srcRect, size, false); | - |
1486 | return true; never executed: return true; | 0 |
1487 | } | - |
1488 | | - |
1489 | void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem) | - |
1490 | { | - |
1491 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1492 | | - |
1493 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
1494 | QOpenGL2PaintEngineState *s = state(); never executed (the execution status of this line is deduced): QOpenGL2PaintEngineState *s = state(); | - |
1495 | | - |
1496 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); never executed (the execution status of this line is deduced): const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - |
1497 | | - |
1498 | QTransform::TransformationType txtype = s->matrix.type(); never executed (the execution status of this line is deduced): QTransform::TransformationType txtype = s->matrix.type(); | - |
1499 | | - |
1500 | float det = s->matrix.determinant(); never executed (the execution status of this line is deduced): float det = s->matrix.determinant(); | - |
1501 | bool drawCached = txtype < QTransform::TxProject; never executed (the execution status of this line is deduced): bool drawCached = txtype < QTransform::TxProject; | - |
1502 | | - |
1503 | // don't try to cache huge fonts or vastly transformed fonts | - |
1504 | if (!shouldDrawCachedGlyphs(ti.fontEngine, s->matrix) || det < 0.25f || det > 4.f) never evaluated: !shouldDrawCachedGlyphs(ti.fontEngine, s->matrix) never evaluated: det < 0.25f never evaluated: det > 4.f | 0 |
1505 | drawCached = false; never executed: drawCached = false; | 0 |
1506 | | - |
1507 | QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 never evaluated: ti.fontEngine->glyphFormat >= 0 | 0 |
1508 | ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) never executed (the execution status of this line is deduced): ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) | - |
1509 | : d->glyphCacheType; never executed (the execution status of this line is deduced): : d->glyphCacheType; | - |
1510 | | - |
1511 | | - |
1512 | if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { never evaluated: glyphType == QFontEngineGlyphCache::Raster_RGBMask | 0 |
1513 | if (!QGLFramebufferObject::hasOpenGLFramebufferObjects() never evaluated: !QGLFramebufferObject::hasOpenGLFramebufferObjects() | 0 |
1514 | || d->device->alphaRequested() || txtype > QTransform::TxTranslate never evaluated: d->device->alphaRequested() never evaluated: txtype > QTransform::TxTranslate | 0 |
1515 | || (state()->composition_mode != QPainter::CompositionMode_Source never evaluated: state()->composition_mode != QPainter::CompositionMode_Source | 0 |
1516 | && state()->composition_mode != QPainter::CompositionMode_SourceOver)) never evaluated: state()->composition_mode != QPainter::CompositionMode_SourceOver | 0 |
1517 | { | - |
1518 | glyphType = QFontEngineGlyphCache::Raster_A8; never executed (the execution status of this line is deduced): glyphType = QFontEngineGlyphCache::Raster_A8; | - |
1519 | } | 0 |
1520 | } | 0 |
1521 | | - |
1522 | if (drawCached) { never evaluated: drawCached | 0 |
1523 | QVarLengthArray<QFixedPoint> positions; never executed (the execution status of this line is deduced): QVarLengthArray<QFixedPoint> positions; | - |
1524 | QVarLengthArray<glyph_t> glyphs; never executed (the execution status of this line is deduced): QVarLengthArray<glyph_t> glyphs; | - |
1525 | QTransform matrix = QTransform::fromTranslate(p.x(), p.y()); never executed (the execution status of this line is deduced): QTransform matrix = QTransform::fromTranslate(p.x(), p.y()); | - |
1526 | ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); never executed (the execution status of this line is deduced): ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); | - |
1527 | | - |
1528 | { | - |
1529 | QStaticTextItem staticTextItem; never executed (the execution status of this line is deduced): QStaticTextItem staticTextItem; | - |
1530 | staticTextItem.chars = const_cast<QChar *>(ti.chars); never executed (the execution status of this line is deduced): staticTextItem.chars = const_cast<QChar *>(ti.chars); | - |
1531 | staticTextItem.setFontEngine(ti.fontEngine); never executed (the execution status of this line is deduced): staticTextItem.setFontEngine(ti.fontEngine); | - |
1532 | staticTextItem.glyphs = glyphs.data(); never executed (the execution status of this line is deduced): staticTextItem.glyphs = glyphs.data(); | - |
1533 | staticTextItem.numChars = ti.num_chars; never executed (the execution status of this line is deduced): staticTextItem.numChars = ti.num_chars; | - |
1534 | staticTextItem.numGlyphs = glyphs.size(); never executed (the execution status of this line is deduced): staticTextItem.numGlyphs = glyphs.size(); | - |
1535 | staticTextItem.glyphPositions = positions.data(); never executed (the execution status of this line is deduced): staticTextItem.glyphPositions = positions.data(); | - |
1536 | | - |
1537 | d->drawCachedGlyphs(glyphType, &staticTextItem); never executed (the execution status of this line is deduced): d->drawCachedGlyphs(glyphType, &staticTextItem); | - |
1538 | } | - |
1539 | return; | 0 |
1540 | } | - |
1541 | | - |
1542 | QPaintEngineEx::drawTextItem(p, ti); never executed (the execution status of this line is deduced): QPaintEngineEx::drawTextItem(p, ti); | - |
1543 | } | 0 |
1544 | | - |
1545 | namespace { | - |
1546 | | - |
1547 | class QOpenGLStaticTextUserData: public QStaticTextUserData | - |
1548 | { | - |
1549 | public: | - |
1550 | QOpenGLStaticTextUserData() | - |
1551 | : QStaticTextUserData(OpenGLUserData), cacheSize(0, 0), cacheSerialNumber(0) | - |
1552 | { | - |
1553 | } | 0 |
1554 | | - |
1555 | ~QOpenGLStaticTextUserData() | - |
1556 | { | - |
1557 | } | - |
1558 | | - |
1559 | QSize cacheSize; | - |
1560 | QGL2PEXVertexArray vertexCoordinateArray; | - |
1561 | QGL2PEXVertexArray textureCoordinateArray; | - |
1562 | QFontEngineGlyphCache::Type glyphType; | - |
1563 | int cacheSerialNumber; | - |
1564 | }; | - |
1565 | | - |
1566 | } | - |
1567 | | - |
1568 | | - |
1569 | // #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO | - |
1570 | | - |
1571 | void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, | - |
1572 | QStaticTextItem *staticTextItem) | - |
1573 | { | - |
1574 | Q_Q(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineEx * const q = q_func(); | - |
1575 | | - |
1576 | QOpenGL2PaintEngineState *s = q->state(); never executed (the execution status of this line is deduced): QOpenGL2PaintEngineState *s = q->state(); | - |
1577 | | - |
1578 | void *cacheKey = const_cast<QGLContext *>(QGLContextPrivate::contextGroup(ctx)->context()); never executed (the execution status of this line is deduced): void *cacheKey = const_cast<QGLContext *>(QGLContextPrivate::contextGroup(ctx)->context()); | - |
1579 | bool recreateVertexArrays = false; never executed (the execution status of this line is deduced): bool recreateVertexArrays = false; | - |
1580 | | - |
1581 | QFontEngine *fe = staticTextItem->fontEngine(); never executed (the execution status of this line is deduced): QFontEngine *fe = staticTextItem->fontEngine(); | - |
1582 | QGLTextureGlyphCache *cache = never executed (the execution status of this line is deduced): QGLTextureGlyphCache *cache = | - |
1583 | (QGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphType, QTransform()); never executed (the execution status of this line is deduced): (QGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphType, QTransform()); | - |
1584 | if (!cache || cache->cacheType() != glyphType || cache->contextGroup() == 0) { never evaluated: !cache never evaluated: cache->cacheType() != glyphType never evaluated: cache->contextGroup() == 0 | 0 |
1585 | cache = new QGLTextureGlyphCache(glyphType, QTransform()); never executed (the execution status of this line is deduced): cache = new QGLTextureGlyphCache(glyphType, QTransform()); | - |
1586 | fe->setGlyphCache(cacheKey, cache); never executed (the execution status of this line is deduced): fe->setGlyphCache(cacheKey, cache); | - |
1587 | recreateVertexArrays = true; never executed (the execution status of this line is deduced): recreateVertexArrays = true; | - |
1588 | } | 0 |
1589 | | - |
1590 | if (staticTextItem->userDataNeedsUpdate) { never evaluated: staticTextItem->userDataNeedsUpdate | 0 |
1591 | recreateVertexArrays = true; never executed (the execution status of this line is deduced): recreateVertexArrays = true; | - |
1592 | } else if (staticTextItem->userData() == 0) { never executed: } never evaluated: staticTextItem->userData() == 0 | 0 |
1593 | recreateVertexArrays = true; never executed (the execution status of this line is deduced): recreateVertexArrays = true; | - |
1594 | } else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) { never executed: } never evaluated: staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData | 0 |
1595 | recreateVertexArrays = true; never executed (the execution status of this line is deduced): recreateVertexArrays = true; | - |
1596 | } else { | 0 |
1597 | QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData()); never executed (the execution status of this line is deduced): QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData()); | - |
1598 | if (userData->glyphType != glyphType) { never evaluated: userData->glyphType != glyphType | 0 |
1599 | recreateVertexArrays = true; never executed (the execution status of this line is deduced): recreateVertexArrays = true; | - |
1600 | } else if (userData->cacheSerialNumber != cache->serialNumber()) { never executed: } never evaluated: userData->cacheSerialNumber != cache->serialNumber() | 0 |
1601 | recreateVertexArrays = true; never executed (the execution status of this line is deduced): recreateVertexArrays = true; | - |
1602 | } | 0 |
1603 | } | - |
1604 | | - |
1605 | // We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays. | - |
1606 | // If the cache size has changed, we do need to regenerate the vertices, but we don't need to repopulate the | - |
1607 | // cache so this text is performed before we test if the cache size has changed. | - |
1608 | if (recreateVertexArrays) { never evaluated: recreateVertexArrays | 0 |
1609 | cache->setPaintEnginePrivate(this); never executed (the execution status of this line is deduced): cache->setPaintEnginePrivate(this); | - |
1610 | if (!cache->populate(fe, staticTextItem->numGlyphs, never evaluated: !cache->populate(fe, staticTextItem->numGlyphs, staticTextItem->glyphs, staticTextItem->glyphPositions) | 0 |
1611 | staticTextItem->glyphs, staticTextItem->glyphPositions)) { never evaluated: !cache->populate(fe, staticTextItem->numGlyphs, staticTextItem->glyphs, staticTextItem->glyphPositions) | 0 |
1612 | // No space for glyphs in cache. We need to reset it and try again. | - |
1613 | cache->clear(); never executed (the execution status of this line is deduced): cache->clear(); | - |
1614 | cache->populate(fe, staticTextItem->numGlyphs, never executed (the execution status of this line is deduced): cache->populate(fe, staticTextItem->numGlyphs, | - |
1615 | staticTextItem->glyphs, staticTextItem->glyphPositions); never executed (the execution status of this line is deduced): staticTextItem->glyphs, staticTextItem->glyphPositions); | - |
1616 | } | 0 |
1617 | cache->fillInPendingGlyphs(); never executed (the execution status of this line is deduced): cache->fillInPendingGlyphs(); | - |
1618 | } | 0 |
1619 | | - |
1620 | if (cache->width() == 0 || cache->height() == 0) never evaluated: cache->width() == 0 never evaluated: cache->height() == 0 | 0 |
1621 | return; | 0 |
1622 | | - |
1623 | transferMode(TextDrawingMode); never executed (the execution status of this line is deduced): transferMode(TextDrawingMode); | - |
1624 | | - |
1625 | int margin = fe->glyphMargin(glyphType); never executed (the execution status of this line is deduced): int margin = fe->glyphMargin(glyphType); | - |
1626 | | - |
1627 | GLfloat dx = 1.0 / cache->width(); never executed (the execution status of this line is deduced): GLfloat dx = 1.0 / cache->width(); | - |
1628 | GLfloat dy = 1.0 / cache->height(); never executed (the execution status of this line is deduced): GLfloat dy = 1.0 / cache->height(); | - |
1629 | | - |
1630 | // Use global arrays by default | - |
1631 | QGL2PEXVertexArray *vertexCoordinates = &vertexCoordinateArray; never executed (the execution status of this line is deduced): QGL2PEXVertexArray *vertexCoordinates = &vertexCoordinateArray; | - |
1632 | QGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray; never executed (the execution status of this line is deduced): QGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray; | - |
1633 | | - |
1634 | if (staticTextItem->useBackendOptimizations) { never evaluated: staticTextItem->useBackendOptimizations | 0 |
1635 | QOpenGLStaticTextUserData *userData = 0; never executed (the execution status of this line is deduced): QOpenGLStaticTextUserData *userData = 0; | - |
1636 | | - |
1637 | if (staticTextItem->userData() == 0 never evaluated: staticTextItem->userData() == 0 | 0 |
1638 | || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) { never evaluated: staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData | 0 |
1639 | | - |
1640 | userData = new QOpenGLStaticTextUserData(); never executed (the execution status of this line is deduced): userData = new QOpenGLStaticTextUserData(); | - |
1641 | staticTextItem->setUserData(userData); never executed (the execution status of this line is deduced): staticTextItem->setUserData(userData); | - |
1642 | | - |
1643 | } else { | 0 |
1644 | userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData()); never executed (the execution status of this line is deduced): userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData()); | - |
1645 | } | 0 |
1646 | | - |
1647 | userData->glyphType = glyphType; never executed (the execution status of this line is deduced): userData->glyphType = glyphType; | - |
1648 | userData->cacheSerialNumber = cache->serialNumber(); never executed (the execution status of this line is deduced): userData->cacheSerialNumber = cache->serialNumber(); | - |
1649 | | - |
1650 | // Use cache if backend optimizations is turned on | - |
1651 | vertexCoordinates = &userData->vertexCoordinateArray; never executed (the execution status of this line is deduced): vertexCoordinates = &userData->vertexCoordinateArray; | - |
1652 | textureCoordinates = &userData->textureCoordinateArray; never executed (the execution status of this line is deduced): textureCoordinates = &userData->textureCoordinateArray; | - |
1653 | | - |
1654 | QSize size(cache->width(), cache->height()); never executed (the execution status of this line is deduced): QSize size(cache->width(), cache->height()); | - |
1655 | if (userData->cacheSize != size) { never evaluated: userData->cacheSize != size | 0 |
1656 | recreateVertexArrays = true; never executed (the execution status of this line is deduced): recreateVertexArrays = true; | - |
1657 | userData->cacheSize = size; never executed (the execution status of this line is deduced): userData->cacheSize = size; | - |
1658 | } | 0 |
1659 | } | 0 |
1660 | | - |
1661 | if (recreateVertexArrays) { never evaluated: recreateVertexArrays | 0 |
1662 | vertexCoordinates->clear(); never executed (the execution status of this line is deduced): vertexCoordinates->clear(); | - |
1663 | textureCoordinates->clear(); never executed (the execution status of this line is deduced): textureCoordinates->clear(); | - |
1664 | | - |
1665 | bool supportsSubPixelPositions = fe->supportsSubPixelPositions(); never executed (the execution status of this line is deduced): bool supportsSubPixelPositions = fe->supportsSubPixelPositions(); | - |
1666 | for (int i=0; i<staticTextItem->numGlyphs; ++i) { never evaluated: i<staticTextItem->numGlyphs | 0 |
1667 | QFixed subPixelPosition; never executed (the execution status of this line is deduced): QFixed subPixelPosition; | - |
1668 | if (supportsSubPixelPositions) never evaluated: supportsSubPixelPositions | 0 |
1669 | subPixelPosition = fe->subPixelPositionForX(staticTextItem->glyphPositions[i].x); never executed: subPixelPosition = fe->subPixelPositionForX(staticTextItem->glyphPositions[i].x); | 0 |
1670 | | - |
1671 | QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition); never executed (the execution status of this line is deduced): QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition); | - |
1672 | | - |
1673 | const QTextureGlyphCache::Coord &c = cache->coords[glyph]; never executed (the execution status of this line is deduced): const QTextureGlyphCache::Coord &c = cache->coords[glyph]; | - |
1674 | if (c.isNull()) never evaluated: c.isNull() | 0 |
1675 | continue; never executed: continue; | 0 |
1676 | | - |
1677 | int x = qFloor(staticTextItem->glyphPositions[i].x) + c.baseLineX - margin; never executed (the execution status of this line is deduced): int x = qFloor(staticTextItem->glyphPositions[i].x) + c.baseLineX - margin; | - |
1678 | int y = qRound(staticTextItem->glyphPositions[i].y) - c.baseLineY - margin; never executed (the execution status of this line is deduced): int y = qRound(staticTextItem->glyphPositions[i].y) - c.baseLineY - margin; | - |
1679 | | - |
1680 | vertexCoordinates->addQuad(QRectF(x, y, c.w, c.h)); never executed (the execution status of this line is deduced): vertexCoordinates->addQuad(QRectF(x, y, c.w, c.h)); | - |
1681 | textureCoordinates->addQuad(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy)); never executed (the execution status of this line is deduced): textureCoordinates->addQuad(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy)); | - |
1682 | } | 0 |
1683 | | - |
1684 | staticTextItem->userDataNeedsUpdate = false; never executed (the execution status of this line is deduced): staticTextItem->userDataNeedsUpdate = false; | - |
1685 | } | 0 |
1686 | | - |
1687 | int numGlyphs = vertexCoordinates->vertexCount() / 4; never executed (the execution status of this line is deduced): int numGlyphs = vertexCoordinates->vertexCount() / 4; | - |
1688 | if (numGlyphs == 0) never evaluated: numGlyphs == 0 | 0 |
1689 | return; | 0 |
1690 | | - |
1691 | if (elementIndices.size() < numGlyphs*6) { never evaluated: elementIndices.size() < numGlyphs*6 | 0 |
1692 | Q_ASSERT(elementIndices.size() % 6 == 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
1693 | int j = elementIndices.size() / 6 * 4; never executed (the execution status of this line is deduced): int j = elementIndices.size() / 6 * 4; | - |
1694 | while (j < numGlyphs*4) { never evaluated: j < numGlyphs*4 | 0 |
1695 | elementIndices.append(j + 0); never executed (the execution status of this line is deduced): elementIndices.append(j + 0); | - |
1696 | elementIndices.append(j + 0); never executed (the execution status of this line is deduced): elementIndices.append(j + 0); | - |
1697 | elementIndices.append(j + 1); never executed (the execution status of this line is deduced): elementIndices.append(j + 1); | - |
1698 | elementIndices.append(j + 2); never executed (the execution status of this line is deduced): elementIndices.append(j + 2); | - |
1699 | elementIndices.append(j + 3); never executed (the execution status of this line is deduced): elementIndices.append(j + 3); | - |
1700 | elementIndices.append(j + 3); never executed (the execution status of this line is deduced): elementIndices.append(j + 3); | - |
1701 | | - |
1702 | j += 4; never executed (the execution status of this line is deduced): j += 4; | - |
1703 | } | 0 |
1704 | | - |
1705 | #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) | - |
1706 | if (elementIndicesVBOId == 0) | - |
1707 | glGenBuffers(1, &elementIndicesVBOId); | - |
1708 | | - |
1709 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId); | - |
1710 | glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementIndices.size() * sizeof(GLushort), | - |
1711 | elementIndices.constData(), GL_STATIC_DRAW); | - |
1712 | #endif | - |
1713 | } else { | 0 |
1714 | #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) | - |
1715 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId); | - |
1716 | #endif | - |
1717 | } | 0 |
1718 | | - |
1719 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinates->data()); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinates->data()); | - |
1720 | setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinates->data()); never executed (the execution status of this line is deduced): setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinates->data()); | - |
1721 | | - |
1722 | if (!snapToPixelGrid) { never evaluated: !snapToPixelGrid | 0 |
1723 | snapToPixelGrid = true; never executed (the execution status of this line is deduced): snapToPixelGrid = true; | - |
1724 | matrixDirty = true; never executed (the execution status of this line is deduced): matrixDirty = true; | - |
1725 | } | 0 |
1726 | | - |
1727 | QBrush pensBrush = q->state()->pen.brush(); never executed (the execution status of this line is deduced): QBrush pensBrush = q->state()->pen.brush(); | - |
1728 | setBrush(pensBrush); never executed (the execution status of this line is deduced): setBrush(pensBrush); | - |
1729 | | - |
1730 | if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { never evaluated: glyphType == QFontEngineGlyphCache::Raster_RGBMask | 0 |
1731 | | - |
1732 | // Subpixel antialiasing without gamma correction | - |
1733 | | - |
1734 | QPainter::CompositionMode compMode = q->state()->composition_mode; never executed (the execution status of this line is deduced): QPainter::CompositionMode compMode = q->state()->composition_mode; | - |
1735 | Q_ASSERT(compMode == QPainter::CompositionMode_Source never executed (the execution status of this line is deduced): qt_noop(); | - |
1736 | || compMode == QPainter::CompositionMode_SourceOver); | - |
1737 | | - |
1738 | shaderManager->setMaskType(QGLEngineShaderManager::SubPixelMaskPass1); never executed (the execution status of this line is deduced): shaderManager->setMaskType(QGLEngineShaderManager::SubPixelMaskPass1); | - |
1739 | | - |
1740 | if (pensBrush.style() == Qt::SolidPattern) { never evaluated: pensBrush.style() == Qt::SolidPattern | 0 |
1741 | // Solid patterns can get away with only one pass. | - |
1742 | QColor c = pensBrush.color(); never executed (the execution status of this line is deduced): QColor c = pensBrush.color(); | - |
1743 | qreal oldOpacity = q->state()->opacity; never executed (the execution status of this line is deduced): qreal oldOpacity = q->state()->opacity; | - |
1744 | if (compMode == QPainter::CompositionMode_Source) { never evaluated: compMode == QPainter::CompositionMode_Source | 0 |
1745 | c = qt_premultiplyColor(c, q->state()->opacity); never executed (the execution status of this line is deduced): c = qt_premultiplyColor(c, q->state()->opacity); | - |
1746 | q->state()->opacity = 1; never executed (the execution status of this line is deduced): q->state()->opacity = 1; | - |
1747 | opacityUniformDirty = true; never executed (the execution status of this line is deduced): opacityUniformDirty = true; | - |
1748 | } | 0 |
1749 | | - |
1750 | compositionModeDirty = false; // I can handle this myself, thank you very much never executed (the execution status of this line is deduced): compositionModeDirty = false; | - |
1751 | prepareForDraw(false); // Text always causes src pixels to be transparent never executed (the execution status of this line is deduced): prepareForDraw(false); | - |
1752 | | - |
1753 | // prepareForDraw() have set the opacity on the current shader, so the opacity state can now be reset. | - |
1754 | if (compMode == QPainter::CompositionMode_Source) { never evaluated: compMode == QPainter::CompositionMode_Source | 0 |
1755 | q->state()->opacity = oldOpacity; never executed (the execution status of this line is deduced): q->state()->opacity = oldOpacity; | - |
1756 | opacityUniformDirty = true; never executed (the execution status of this line is deduced): opacityUniformDirty = true; | - |
1757 | } | 0 |
1758 | | - |
1759 | glEnable(GL_BLEND); never executed (the execution status of this line is deduced): glEnable(0x0BE2); | - |
1760 | glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR); never executed (the execution status of this line is deduced): glBlendFunc(0x8001, 0x0301); | - |
1761 | glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); | - |
1762 | } else { | 0 |
1763 | // Other brush styles need two passes. | - |
1764 | | - |
1765 | qreal oldOpacity = q->state()->opacity; never executed (the execution status of this line is deduced): qreal oldOpacity = q->state()->opacity; | - |
1766 | if (compMode == QPainter::CompositionMode_Source) { never evaluated: compMode == QPainter::CompositionMode_Source | 0 |
1767 | q->state()->opacity = 1; never executed (the execution status of this line is deduced): q->state()->opacity = 1; | - |
1768 | opacityUniformDirty = true; never executed (the execution status of this line is deduced): opacityUniformDirty = true; | - |
1769 | pensBrush = Qt::white; never executed (the execution status of this line is deduced): pensBrush = Qt::white; | - |
1770 | setBrush(pensBrush); never executed (the execution status of this line is deduced): setBrush(pensBrush); | - |
1771 | } | 0 |
1772 | | - |
1773 | compositionModeDirty = false; // I can handle this myself, thank you very much never executed (the execution status of this line is deduced): compositionModeDirty = false; | - |
1774 | prepareForDraw(false); // Text always causes src pixels to be transparent never executed (the execution status of this line is deduced): prepareForDraw(false); | - |
1775 | glEnable(GL_BLEND); never executed (the execution status of this line is deduced): glEnable(0x0BE2); | - |
1776 | glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); never executed (the execution status of this line is deduced): glBlendFunc(0x0, 0x0301); | - |
1777 | | - |
1778 | glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(1)); | - |
1779 | glBindTexture(GL_TEXTURE_2D, cache->texture()); never executed (the execution status of this line is deduced): glBindTexture(0x0DE1, cache->texture()); | - |
1780 | updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false); never executed (the execution status of this line is deduced): updateTextureFilter(0x0DE1, 0x2901, false); | - |
1781 | | - |
1782 | #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) | - |
1783 | glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); | - |
1784 | #else | - |
1785 | glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); never executed (the execution status of this line is deduced): glDrawElements(0x0005, 6 * numGlyphs, 0x1403, elementIndices.data()); | - |
1786 | #endif | - |
1787 | | - |
1788 | shaderManager->setMaskType(QGLEngineShaderManager::SubPixelMaskPass2); never executed (the execution status of this line is deduced): shaderManager->setMaskType(QGLEngineShaderManager::SubPixelMaskPass2); | - |
1789 | | - |
1790 | if (compMode == QPainter::CompositionMode_Source) { never evaluated: compMode == QPainter::CompositionMode_Source | 0 |
1791 | q->state()->opacity = oldOpacity; never executed (the execution status of this line is deduced): q->state()->opacity = oldOpacity; | - |
1792 | opacityUniformDirty = true; never executed (the execution status of this line is deduced): opacityUniformDirty = true; | - |
1793 | pensBrush = q->state()->pen.brush(); never executed (the execution status of this line is deduced): pensBrush = q->state()->pen.brush(); | - |
1794 | setBrush(pensBrush); never executed (the execution status of this line is deduced): setBrush(pensBrush); | - |
1795 | } | 0 |
1796 | | - |
1797 | compositionModeDirty = false; never executed (the execution status of this line is deduced): compositionModeDirty = false; | - |
1798 | prepareForDraw(false); // Text always causes src pixels to be transparent never executed (the execution status of this line is deduced): prepareForDraw(false); | - |
1799 | glEnable(GL_BLEND); never executed (the execution status of this line is deduced): glEnable(0x0BE2); | - |
1800 | glBlendFunc(GL_ONE, GL_ONE); never executed (the execution status of this line is deduced): glBlendFunc(0x1, 0x1); | - |
1801 | } | 0 |
1802 | compositionModeDirty = true; never executed (the execution status of this line is deduced): compositionModeDirty = true; | - |
1803 | } else { | 0 |
1804 | // Greyscale/mono glyphs | - |
1805 | | - |
1806 | shaderManager->setMaskType(QGLEngineShaderManager::PixelMask); never executed (the execution status of this line is deduced): shaderManager->setMaskType(QGLEngineShaderManager::PixelMask); | - |
1807 | prepareForDraw(false); // Text always causes src pixels to be transparent never executed (the execution status of this line is deduced): prepareForDraw(false); | - |
1808 | } | 0 |
1809 | | - |
1810 | QGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate)?QGLTextureGlyphCache::Linear:QGLTextureGlyphCache::Nearest; never evaluated: (s->matrix.type() > QTransform::TxTranslate) | 0 |
1811 | if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) { never evaluated: lastMaskTextureUsed != cache->texture() never evaluated: cache->filterMode() != filterMode | 0 |
1812 | | - |
1813 | glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(1)); | - |
1814 | if (lastMaskTextureUsed != cache->texture()) { never evaluated: lastMaskTextureUsed != cache->texture() | 0 |
1815 | glBindTexture(GL_TEXTURE_2D, cache->texture()); never executed (the execution status of this line is deduced): glBindTexture(0x0DE1, cache->texture()); | - |
1816 | lastMaskTextureUsed = cache->texture(); never executed (the execution status of this line is deduced): lastMaskTextureUsed = cache->texture(); | - |
1817 | } | 0 |
1818 | | - |
1819 | if (cache->filterMode() != filterMode) { never evaluated: cache->filterMode() != filterMode | 0 |
1820 | if (filterMode == QGLTextureGlyphCache::Linear) { never evaluated: filterMode == QGLTextureGlyphCache::Linear | 0 |
1821 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); never executed (the execution status of this line is deduced): glTexParameteri(0x0DE1, 0x2800, 0x2601); | - |
1822 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); never executed (the execution status of this line is deduced): glTexParameteri(0x0DE1, 0x2801, 0x2601); | - |
1823 | } else { | 0 |
1824 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); never executed (the execution status of this line is deduced): glTexParameteri(0x0DE1, 0x2800, 0x2600); | - |
1825 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); never executed (the execution status of this line is deduced): glTexParameteri(0x0DE1, 0x2801, 0x2600); | - |
1826 | } | 0 |
1827 | cache->setFilterMode(filterMode); never executed (the execution status of this line is deduced): cache->setFilterMode(filterMode); | - |
1828 | } | 0 |
1829 | } | 0 |
1830 | | - |
1831 | bool srgbFrameBufferEnabled = false; never executed (the execution status of this line is deduced): bool srgbFrameBufferEnabled = false; | - |
1832 | | - |
1833 | #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) | - |
1834 | glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); | - |
1835 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | - |
1836 | #else | - |
1837 | glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); never executed (the execution status of this line is deduced): glDrawElements(0x0005, 6 * numGlyphs, 0x1403, elementIndices.data()); | - |
1838 | #endif | - |
1839 | | - |
1840 | if (srgbFrameBufferEnabled) never evaluated: srgbFrameBufferEnabled | 0 |
1841 | glDisable(GL_FRAMEBUFFER_SRGB); never executed: glDisable(0x8DB9); | 0 |
1842 | | - |
1843 | } | 0 |
1844 | | - |
1845 | void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, | - |
1846 | QPainter::PixmapFragmentHints hints) | - |
1847 | { | - |
1848 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1849 | // Use fallback for extended composition modes. | - |
1850 | if (state()->composition_mode > QPainter::CompositionMode_Plus) { never evaluated: state()->composition_mode > QPainter::CompositionMode_Plus | 0 |
1851 | QPaintEngineEx::drawPixmapFragments(fragments, fragmentCount, pixmap, hints); never executed (the execution status of this line is deduced): QPaintEngineEx::drawPixmapFragments(fragments, fragmentCount, pixmap, hints); | - |
1852 | return; | 0 |
1853 | } | - |
1854 | | - |
1855 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
1856 | int max_texture_size = d->ctx->d_func()->maxTextureSize(); never executed (the execution status of this line is deduced): int max_texture_size = d->ctx->d_func()->maxTextureSize(); | - |
1857 | if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) { never evaluated: pixmap.width() > max_texture_size never evaluated: pixmap.height() > max_texture_size | 0 |
1858 | QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); never executed (the execution status of this line is deduced): QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); | - |
1859 | d->drawPixmapFragments(fragments, fragmentCount, scaled, hints); never executed (the execution status of this line is deduced): d->drawPixmapFragments(fragments, fragmentCount, scaled, hints); | - |
1860 | } else { | 0 |
1861 | d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); never executed (the execution status of this line is deduced): d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); | - |
1862 | } | 0 |
1863 | } | - |
1864 | | - |
1865 | | - |
1866 | void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragment *fragments, | - |
1867 | int fragmentCount, const QPixmap &pixmap, | - |
1868 | QPainter::PixmapFragmentHints hints) | - |
1869 | { | - |
1870 | GLfloat dx = 1.0f / pixmap.size().width(); never executed (the execution status of this line is deduced): GLfloat dx = 1.0f / pixmap.size().width(); | - |
1871 | GLfloat dy = 1.0f / pixmap.size().height(); never executed (the execution status of this line is deduced): GLfloat dy = 1.0f / pixmap.size().height(); | - |
1872 | | - |
1873 | vertexCoordinateArray.clear(); never executed (the execution status of this line is deduced): vertexCoordinateArray.clear(); | - |
1874 | textureCoordinateArray.clear(); never executed (the execution status of this line is deduced): textureCoordinateArray.clear(); | - |
1875 | opacityArray.reset(); never executed (the execution status of this line is deduced): opacityArray.reset(); | - |
1876 | | - |
1877 | if (snapToPixelGrid) { never evaluated: snapToPixelGrid | 0 |
1878 | snapToPixelGrid = false; never executed (the execution status of this line is deduced): snapToPixelGrid = false; | - |
1879 | matrixDirty = true; never executed (the execution status of this line is deduced): matrixDirty = true; | - |
1880 | } | 0 |
1881 | | - |
1882 | bool allOpaque = true; never executed (the execution status of this line is deduced): bool allOpaque = true; | - |
1883 | | - |
1884 | for (int i = 0; i < fragmentCount; ++i) { never evaluated: i < fragmentCount | 0 |
1885 | qreal s = 0; never executed (the execution status of this line is deduced): qreal s = 0; | - |
1886 | qreal c = 1; never executed (the execution status of this line is deduced): qreal c = 1; | - |
1887 | if (fragments[i].rotation != 0) { never evaluated: fragments[i].rotation != 0 | 0 |
1888 | s = qFastSin(fragments[i].rotation * Q_PI / 180); never executed (the execution status of this line is deduced): s = qFastSin(fragments[i].rotation * Q_PI / 180); | - |
1889 | c = qFastCos(fragments[i].rotation * Q_PI / 180); never executed (the execution status of this line is deduced): c = qFastCos(fragments[i].rotation * Q_PI / 180); | - |
1890 | } | 0 |
1891 | | - |
1892 | qreal right = 0.5 * fragments[i].scaleX * fragments[i].width; never executed (the execution status of this line is deduced): qreal right = 0.5 * fragments[i].scaleX * fragments[i].width; | - |
1893 | qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height; never executed (the execution status of this line is deduced): qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height; | - |
1894 | QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c); never executed (the execution status of this line is deduced): QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c); | - |
1895 | QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c); never executed (the execution status of this line is deduced): QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c); | - |
1896 | | - |
1897 | vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); never executed (the execution status of this line is deduced): vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); | - |
1898 | vertexCoordinateArray.addVertex(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y); never executed (the execution status of this line is deduced): vertexCoordinateArray.addVertex(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y); | - |
1899 | vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); never executed (the execution status of this line is deduced): vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); | - |
1900 | vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); never executed (the execution status of this line is deduced): vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); | - |
1901 | vertexCoordinateArray.addVertex(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y); never executed (the execution status of this line is deduced): vertexCoordinateArray.addVertex(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y); | - |
1902 | vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); never executed (the execution status of this line is deduced): vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); | - |
1903 | | - |
1904 | QGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy, never executed (the execution status of this line is deduced): QGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy, | - |
1905 | (fragments[i].sourceLeft + fragments[i].width) * dx, never executed (the execution status of this line is deduced): (fragments[i].sourceLeft + fragments[i].width) * dx, | - |
1906 | (fragments[i].sourceTop + fragments[i].height) * dy); never executed (the execution status of this line is deduced): (fragments[i].sourceTop + fragments[i].height) * dy); | - |
1907 | | - |
1908 | textureCoordinateArray.addVertex(src.right, src.bottom); never executed (the execution status of this line is deduced): textureCoordinateArray.addVertex(src.right, src.bottom); | - |
1909 | textureCoordinateArray.addVertex(src.right, src.top); never executed (the execution status of this line is deduced): textureCoordinateArray.addVertex(src.right, src.top); | - |
1910 | textureCoordinateArray.addVertex(src.left, src.top); never executed (the execution status of this line is deduced): textureCoordinateArray.addVertex(src.left, src.top); | - |
1911 | textureCoordinateArray.addVertex(src.left, src.top); never executed (the execution status of this line is deduced): textureCoordinateArray.addVertex(src.left, src.top); | - |
1912 | textureCoordinateArray.addVertex(src.left, src.bottom); never executed (the execution status of this line is deduced): textureCoordinateArray.addVertex(src.left, src.bottom); | - |
1913 | textureCoordinateArray.addVertex(src.right, src.bottom); never executed (the execution status of this line is deduced): textureCoordinateArray.addVertex(src.right, src.bottom); | - |
1914 | | - |
1915 | qreal opacity = fragments[i].opacity * q->state()->opacity; never executed (the execution status of this line is deduced): qreal opacity = fragments[i].opacity * q->state()->opacity; | - |
1916 | opacityArray << opacity << opacity << opacity << opacity << opacity << opacity; never executed (the execution status of this line is deduced): opacityArray << opacity << opacity << opacity << opacity << opacity << opacity; | - |
1917 | allOpaque &= (opacity >= 0.99f); never executed (the execution status of this line is deduced): allOpaque &= (opacity >= 0.99f); | - |
1918 | } | 0 |
1919 | | - |
1920 | glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture(0x84C0 + GLuint(0)); | - |
1921 | QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, never executed (the execution status of this line is deduced): QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, 0x0DE1, 0x1908, | - |
1922 | QGLContext::InternalBindOption never executed (the execution status of this line is deduced): QGLContext::InternalBindOption | - |
1923 | | QGLContext::CanFlipNativePixmapBindOption); never executed (the execution status of this line is deduced): | QGLContext::CanFlipNativePixmapBindOption); | - |
1924 | | - |
1925 | if (texture->options & QGLContext::InvertedYBindOption) { never evaluated: texture->options & QGLContext::InvertedYBindOption | 0 |
1926 | // Flip texture y-coordinate. | - |
1927 | QGLPoint *data = textureCoordinateArray.data(); never executed (the execution status of this line is deduced): QGLPoint *data = textureCoordinateArray.data(); | - |
1928 | for (int i = 0; i < 6 * fragmentCount; ++i) never evaluated: i < 6 * fragmentCount | 0 |
1929 | data[i].y = 1 - data[i].y; never executed: data[i].y = 1 - data[i].y; | 0 |
1930 | } | 0 |
1931 | | - |
1932 | transferMode(ImageArrayDrawingMode); never executed (the execution status of this line is deduced): transferMode(ImageArrayDrawingMode); | - |
1933 | | - |
1934 | bool isBitmap = pixmap.isQBitmap(); never executed (the execution status of this line is deduced): bool isBitmap = pixmap.isQBitmap(); | - |
1935 | bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque; never evaluated: !isBitmap never evaluated: !pixmap.hasAlpha() never evaluated: (hints & QPainter::OpaqueHint) never evaluated: allOpaque | 0 |
1936 | | - |
1937 | updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, never executed (the execution status of this line is deduced): updateTextureFilter(0x0DE1, 0x812F, | - |
1938 | q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); never executed (the execution status of this line is deduced): q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); | - |
1939 | | - |
1940 | // Setup for texture drawing | - |
1941 | currentBrush = noBrush; never executed (the execution status of this line is deduced): currentBrush = noBrush; | - |
1942 | shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc never executed (the execution status of this line is deduced): shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc | - |
1943 | : QGLEngineShaderManager::ImageSrc); never executed (the execution status of this line is deduced): : QGLEngineShaderManager::ImageSrc); | - |
1944 | if (prepareForDraw(isOpaque)) never evaluated: prepareForDraw(isOpaque) | 0 |
1945 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); never executed: shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), GLuint(0)); | 0 |
1946 | | - |
1947 | if (isBitmap) { never evaluated: isBitmap | 0 |
1948 | QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); never executed (the execution status of this line is deduced): QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); | - |
1949 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); never executed (the execution status of this line is deduced): shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); | - |
1950 | } | 0 |
1951 | | - |
1952 | glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount); never executed (the execution status of this line is deduced): glDrawArrays(0x0004, 0, 6 * fragmentCount); | - |
1953 | } | 0 |
1954 | | - |
1955 | bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) | - |
1956 | { | - |
1957 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
1958 | | - |
1959 | // qDebug("QGL2PaintEngineEx::begin()"); | - |
1960 | if (pdev->devType() == QInternal::OpenGL) never evaluated: pdev->devType() == QInternal::OpenGL | 0 |
1961 | d->device = static_cast<QGLPaintDevice*>(pdev); never executed: d->device = static_cast<QGLPaintDevice*>(pdev); | 0 |
1962 | else | - |
1963 | d->device = QGLPaintDevice::getDevice(pdev); never executed: d->device = QGLPaintDevice::getDevice(pdev); | 0 |
1964 | | - |
1965 | if (!d->device) never evaluated: !d->device | 0 |
1966 | return false; never executed: return false; | 0 |
1967 | | - |
1968 | d->ctx = d->device->context(); never executed (the execution status of this line is deduced): d->ctx = d->device->context(); | - |
1969 | d->ctx->d_ptr->active_engine = this; never executed (the execution status of this line is deduced): d->ctx->d_ptr->active_engine = this; | - |
1970 | | - |
1971 | const QSize sz = d->device->size(); never executed (the execution status of this line is deduced): const QSize sz = d->device->size(); | - |
1972 | d->width = sz.width(); never executed (the execution status of this line is deduced): d->width = sz.width(); | - |
1973 | d->height = sz.height(); never executed (the execution status of this line is deduced): d->height = sz.height(); | - |
1974 | d->mode = BrushDrawingMode; never executed (the execution status of this line is deduced): d->mode = BrushDrawingMode; | - |
1975 | d->brushTextureDirty = true; never executed (the execution status of this line is deduced): d->brushTextureDirty = true; | - |
1976 | d->brushUniformsDirty = true; never executed (the execution status of this line is deduced): d->brushUniformsDirty = true; | - |
1977 | d->matrixUniformDirty = true; never executed (the execution status of this line is deduced): d->matrixUniformDirty = true; | - |
1978 | d->matrixDirty = true; never executed (the execution status of this line is deduced): d->matrixDirty = true; | - |
1979 | d->compositionModeDirty = true; never executed (the execution status of this line is deduced): d->compositionModeDirty = true; | - |
1980 | d->opacityUniformDirty = true; never executed (the execution status of this line is deduced): d->opacityUniformDirty = true; | - |
1981 | d->needsSync = true; never executed (the execution status of this line is deduced): d->needsSync = true; | - |
1982 | d->useSystemClip = !systemClip().isEmpty(); never executed (the execution status of this line is deduced): d->useSystemClip = !systemClip().isEmpty(); | - |
1983 | d->currentBrush = QBrush(); never executed (the execution status of this line is deduced): d->currentBrush = QBrush(); | - |
1984 | | - |
1985 | d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); never executed (the execution status of this line is deduced): d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); | - |
1986 | d->stencilClean = true; never executed (the execution status of this line is deduced): d->stencilClean = true; | - |
1987 | | - |
1988 | // Calling begin paint should make the correct context current. So, any | - |
1989 | // code which calls into GL or otherwise needs a current context *must* | - |
1990 | // go after beginPaint: | - |
1991 | d->device->beginPaint(); never executed (the execution status of this line is deduced): d->device->beginPaint(); | - |
1992 | | - |
1993 | #if !defined(QT_OPENGL_ES_2) | - |
1994 | bool success = qt_resolve_version_2_0_functions(d->ctx) never evaluated: qt_resolve_version_2_0_functions(d->ctx) | 0 |
1995 | && qt_resolve_buffer_extensions(d->ctx) never evaluated: qt_resolve_buffer_extensions(d->ctx) | 0 |
1996 | && (!QGLFramebufferObject::hasOpenGLFramebufferObjects() never evaluated: !QGLFramebufferObject::hasOpenGLFramebufferObjects() | 0 |
1997 | || qt_resolve_framebufferobject_extensions(d->ctx)); never evaluated: qt_resolve_framebufferobject_extensions(d->ctx) | 0 |
1998 | Q_ASSERT(success); never executed (the execution status of this line is deduced): qt_noop(); | - |
1999 | Q_UNUSED(success); never executed (the execution status of this line is deduced): (void)success;; | - |
2000 | #endif | - |
2001 | | - |
2002 | d->shaderManager = new QGLEngineShaderManager(d->ctx); never executed (the execution status of this line is deduced): d->shaderManager = new QGLEngineShaderManager(d->ctx); | - |
2003 | | - |
2004 | glDisable(GL_STENCIL_TEST); never executed (the execution status of this line is deduced): glDisable(0x0B90); | - |
2005 | glDisable(GL_DEPTH_TEST); never executed (the execution status of this line is deduced): glDisable(0x0B71); | - |
2006 | glDisable(GL_SCISSOR_TEST); never executed (the execution status of this line is deduced): glDisable(0x0C11); | - |
2007 | | - |
2008 | #if !defined(QT_OPENGL_ES_2) | - |
2009 | glDisable(GL_MULTISAMPLE); never executed (the execution status of this line is deduced): glDisable(0x809D); | - |
2010 | #endif | - |
2011 | | - |
2012 | d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; never executed (the execution status of this line is deduced): d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; | - |
2013 | | - |
2014 | #if !defined(QT_OPENGL_ES_2) | - |
2015 | d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; never executed (the execution status of this line is deduced): d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; | - |
2016 | #endif | - |
2017 | | - |
2018 | #if defined(QT_OPENGL_ES_2) | - |
2019 | // OpenGL ES can't switch MSAA off, so if the gl paint device is | - |
2020 | // multisampled, it's always multisampled. | - |
2021 | d->multisamplingAlwaysEnabled = d->device->format().sampleBuffers(); | - |
2022 | #else | - |
2023 | d->multisamplingAlwaysEnabled = false; never executed (the execution status of this line is deduced): d->multisamplingAlwaysEnabled = false; | - |
2024 | #endif | - |
2025 | | - |
2026 | return true; never executed: return true; | 0 |
2027 | } | - |
2028 | | - |
2029 | bool QGL2PaintEngineEx::end() | - |
2030 | { | - |
2031 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
2032 | | - |
2033 | QGLContext *ctx = d->ctx; never executed (the execution status of this line is deduced): QGLContext *ctx = d->ctx; | - |
2034 | glUseProgram(0); never executed (the execution status of this line is deduced): QGLContextPrivate::extensionFuncs(ctx).qt_glUseProgram(0); | - |
2035 | d->transferMode(BrushDrawingMode); never executed (the execution status of this line is deduced): d->transferMode(BrushDrawingMode); | - |
2036 | d->device->endPaint(); never executed (the execution status of this line is deduced): d->device->endPaint(); | - |
2037 | | - |
2038 | ctx->d_ptr->active_engine = 0; never executed (the execution status of this line is deduced): ctx->d_ptr->active_engine = 0; | - |
2039 | | - |
2040 | d->resetGLState(); never executed (the execution status of this line is deduced): d->resetGLState(); | - |
2041 | | - |
2042 | delete d->shaderManager; never executed (the execution status of this line is deduced): delete d->shaderManager; | - |
2043 | d->shaderManager = 0; never executed (the execution status of this line is deduced): d->shaderManager = 0; | - |
2044 | d->currentBrush = QBrush(); never executed (the execution status of this line is deduced): d->currentBrush = QBrush(); | - |
2045 | | - |
2046 | #ifdef QT_OPENGL_CACHE_AS_VBOS | - |
2047 | if (!d->unusedVBOSToClean.isEmpty()) { | - |
2048 | glDeleteBuffers(d->unusedVBOSToClean.size(), d->unusedVBOSToClean.constData()); | - |
2049 | d->unusedVBOSToClean.clear(); | - |
2050 | } | - |
2051 | if (!d->unusedIBOSToClean.isEmpty()) { | - |
2052 | glDeleteBuffers(d->unusedIBOSToClean.size(), d->unusedIBOSToClean.constData()); | - |
2053 | d->unusedIBOSToClean.clear(); | - |
2054 | } | - |
2055 | #endif | - |
2056 | | - |
2057 | return false; never executed: return false; | 0 |
2058 | } | - |
2059 | | - |
2060 | void QGL2PaintEngineEx::ensureActive() | - |
2061 | { | - |
2062 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
2063 | QGLContext *ctx = d->ctx; never executed (the execution status of this line is deduced): QGLContext *ctx = d->ctx; | - |
2064 | | - |
2065 | if (isActive() && ctx->d_ptr->active_engine != this) { never evaluated: isActive() never evaluated: ctx->d_ptr->active_engine != this | 0 |
2066 | ctx->d_ptr->active_engine = this; never executed (the execution status of this line is deduced): ctx->d_ptr->active_engine = this; | - |
2067 | d->needsSync = true; never executed (the execution status of this line is deduced): d->needsSync = true; | - |
2068 | } | 0 |
2069 | | - |
2070 | d->device->ensureActiveTarget(); never executed (the execution status of this line is deduced): d->device->ensureActiveTarget(); | - |
2071 | | - |
2072 | if (d->needsSync) { never evaluated: d->needsSync | 0 |
2073 | d->transferMode(BrushDrawingMode); never executed (the execution status of this line is deduced): d->transferMode(BrushDrawingMode); | - |
2074 | glViewport(0, 0, d->width, d->height); never executed (the execution status of this line is deduced): glViewport(0, 0, d->width, d->height); | - |
2075 | d->needsSync = false; never executed (the execution status of this line is deduced): d->needsSync = false; | - |
2076 | d->lastMaskTextureUsed = 0; never executed (the execution status of this line is deduced): d->lastMaskTextureUsed = 0; | - |
2077 | d->shaderManager->setDirty(); never executed (the execution status of this line is deduced): d->shaderManager->setDirty(); | - |
2078 | d->ctx->d_func()->syncGlState(); never executed (the execution status of this line is deduced): d->ctx->d_func()->syncGlState(); | - |
2079 | for (int i = 0; i < 3; ++i) | 0 |
2080 | d->vertexAttribPointers[i] = (GLfloat*)-1; // Assume the pointers are clobbered never executed: d->vertexAttribPointers[i] = (GLfloat*)-1; | 0 |
2081 | setState(state()); never executed (the execution status of this line is deduced): setState(state()); | - |
2082 | } | 0 |
2083 | } | 0 |
2084 | | - |
2085 | void QGL2PaintEngineExPrivate::updateClipScissorTest() | - |
2086 | { | - |
2087 | Q_Q(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineEx * const q = q_func(); | - |
2088 | if (q->state()->clipTestEnabled) { never evaluated: q->state()->clipTestEnabled | 0 |
2089 | glEnable(GL_STENCIL_TEST); never executed (the execution status of this line is deduced): glEnable(0x0B90); | - |
2090 | glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0203, q->state()->currentClip, ~GLuint(0x80)); | - |
2091 | } else { | 0 |
2092 | glDisable(GL_STENCIL_TEST); never executed (the execution status of this line is deduced): glDisable(0x0B90); | - |
2093 | glStencilFunc(GL_ALWAYS, 0, 0xff); never executed (the execution status of this line is deduced): glStencilFunc(0x0207, 0, 0xff); | - |
2094 | } | 0 |
2095 | | - |
2096 | #ifdef QT_GL_NO_SCISSOR_TEST | - |
2097 | currentScissorBounds = QRect(0, 0, width, height); | - |
2098 | #else | - |
2099 | QRect bounds = q->state()->rectangleClip; never executed (the execution status of this line is deduced): QRect bounds = q->state()->rectangleClip; | - |
2100 | if (!q->state()->clipEnabled) { never evaluated: !q->state()->clipEnabled | 0 |
2101 | if (useSystemClip) never evaluated: useSystemClip | 0 |
2102 | bounds = systemClip.boundingRect(); never executed: bounds = systemClip.boundingRect(); | 0 |
2103 | else | - |
2104 | bounds = QRect(0, 0, width, height); never executed: bounds = QRect(0, 0, width, height); | 0 |
2105 | } else { | - |
2106 | if (useSystemClip) never evaluated: useSystemClip | 0 |
2107 | bounds = bounds.intersected(systemClip.boundingRect()); never executed: bounds = bounds.intersected(systemClip.boundingRect()); | 0 |
2108 | else | - |
2109 | bounds = bounds.intersected(QRect(0, 0, width, height)); never executed: bounds = bounds.intersected(QRect(0, 0, width, height)); | 0 |
2110 | } | - |
2111 | | - |
2112 | currentScissorBounds = bounds; never executed (the execution status of this line is deduced): currentScissorBounds = bounds; | - |
2113 | | - |
2114 | if (bounds == QRect(0, 0, width, height)) { never evaluated: bounds == QRect(0, 0, width, height) | 0 |
2115 | glDisable(GL_SCISSOR_TEST); never executed (the execution status of this line is deduced): glDisable(0x0C11); | - |
2116 | } else { | 0 |
2117 | glEnable(GL_SCISSOR_TEST); never executed (the execution status of this line is deduced): glEnable(0x0C11); | - |
2118 | setScissor(bounds); never executed (the execution status of this line is deduced): setScissor(bounds); | - |
2119 | } | 0 |
2120 | #endif | - |
2121 | } | - |
2122 | | - |
2123 | void QGL2PaintEngineExPrivate::setScissor(const QRect &rect) | - |
2124 | { | - |
2125 | const int left = rect.left(); never executed (the execution status of this line is deduced): const int left = rect.left(); | - |
2126 | const int width = rect.width(); never executed (the execution status of this line is deduced): const int width = rect.width(); | - |
2127 | int bottom = height - (rect.top() + rect.height()); never executed (the execution status of this line is deduced): int bottom = height - (rect.top() + rect.height()); | - |
2128 | if (device->isFlipped()) { never evaluated: device->isFlipped() | 0 |
2129 | bottom = rect.top(); never executed (the execution status of this line is deduced): bottom = rect.top(); | - |
2130 | } | 0 |
2131 | const int height = rect.height(); never executed (the execution status of this line is deduced): const int height = rect.height(); | - |
2132 | | - |
2133 | glScissor(left, bottom, width, height); never executed (the execution status of this line is deduced): glScissor(left, bottom, width, height); | - |
2134 | } | 0 |
2135 | | - |
2136 | void QGL2PaintEngineEx::clipEnabledChanged() | - |
2137 | { | - |
2138 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
2139 | | - |
2140 | state()->clipChanged = true; never executed (the execution status of this line is deduced): state()->clipChanged = true; | - |
2141 | | - |
2142 | if (painter()->hasClipping()) never evaluated: painter()->hasClipping() | 0 |
2143 | d->regenerateClip(); never executed: d->regenerateClip(); | 0 |
2144 | else | - |
2145 | d->systemStateChanged(); never executed: d->systemStateChanged(); | 0 |
2146 | } | - |
2147 | | - |
2148 | void QGL2PaintEngineExPrivate::clearClip(uint value) | - |
2149 | { | - |
2150 | dirtyStencilRegion -= currentScissorBounds; never executed (the execution status of this line is deduced): dirtyStencilRegion -= currentScissorBounds; | - |
2151 | | - |
2152 | glStencilMask(0xff); never executed (the execution status of this line is deduced): glStencilMask(0xff); | - |
2153 | glClearStencil(value); never executed (the execution status of this line is deduced): glClearStencil(value); | - |
2154 | glClear(GL_STENCIL_BUFFER_BIT); never executed (the execution status of this line is deduced): glClear(0x00000400); | - |
2155 | glStencilMask(0x0); never executed (the execution status of this line is deduced): glStencilMask(0x0); | - |
2156 | | - |
2157 | q->state()->needsClipBufferClear = false; never executed (the execution status of this line is deduced): q->state()->needsClipBufferClear = false; | - |
2158 | } | 0 |
2159 | | - |
2160 | void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) | - |
2161 | { | - |
2162 | transferMode(BrushDrawingMode); never executed (the execution status of this line is deduced): transferMode(BrushDrawingMode); | - |
2163 | | - |
2164 | if (snapToPixelGrid) { never evaluated: snapToPixelGrid | 0 |
2165 | snapToPixelGrid = false; never executed (the execution status of this line is deduced): snapToPixelGrid = false; | - |
2166 | matrixDirty = true; never executed (the execution status of this line is deduced): matrixDirty = true; | - |
2167 | } | 0 |
2168 | | - |
2169 | if (matrixDirty) never evaluated: matrixDirty | 0 |
2170 | updateMatrix(); never executed: updateMatrix(); | 0 |
2171 | | - |
2172 | stencilClean = false; never executed (the execution status of this line is deduced): stencilClean = false; | - |
2173 | | - |
2174 | const bool singlePass = !path.hasWindingFill() never evaluated: !path.hasWindingFill() | 0 |
2175 | && (((q->state()->currentClip == maxClip - 1) && q->state()->clipTestEnabled) never evaluated: (q->state()->currentClip == maxClip - 1) never evaluated: q->state()->clipTestEnabled | 0 |
2176 | || q->state()->needsClipBufferClear); never evaluated: q->state()->needsClipBufferClear | 0 |
2177 | const uint referenceClipValue = q->state()->needsClipBufferClear ? 1 : q->state()->currentClip; never evaluated: q->state()->needsClipBufferClear | 0 |
2178 | | - |
2179 | if (q->state()->needsClipBufferClear) never evaluated: q->state()->needsClipBufferClear | 0 |
2180 | clearClip(1); never executed: clearClip(1); | 0 |
2181 | | - |
2182 | if (path.isEmpty()) { never evaluated: path.isEmpty() | 0 |
2183 | glEnable(GL_STENCIL_TEST); never executed (the execution status of this line is deduced): glEnable(0x0B90); | - |
2184 | glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0203, value, ~GLuint(0x80)); | - |
2185 | return; | 0 |
2186 | } | - |
2187 | | - |
2188 | if (q->state()->clipTestEnabled) never evaluated: q->state()->clipTestEnabled | 0 |
2189 | glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); never executed: glStencilFunc(0x0203, q->state()->currentClip, ~GLuint(0x80)); | 0 |
2190 | else | - |
2191 | glStencilFunc(GL_ALWAYS, 0, 0xff); never executed: glStencilFunc(0x0207, 0, 0xff); | 0 |
2192 | | - |
2193 | vertexCoordinateArray.clear(); never executed (the execution status of this line is deduced): vertexCoordinateArray.clear(); | - |
2194 | vertexCoordinateArray.addPath(path, inverseScale, false); never executed (the execution status of this line is deduced): vertexCoordinateArray.addPath(path, inverseScale, false); | - |
2195 | | - |
2196 | if (!singlePass) never evaluated: !singlePass | 0 |
2197 | fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); never executed: fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); | 0 |
2198 | | - |
2199 | glColorMask(false, false, false, false); never executed (the execution status of this line is deduced): glColorMask(false, false, false, false); | - |
2200 | glEnable(GL_STENCIL_TEST); never executed (the execution status of this line is deduced): glEnable(0x0B90); | - |
2201 | useSimpleShader(); never executed (the execution status of this line is deduced): useSimpleShader(); | - |
2202 | | - |
2203 | if (singlePass) { never evaluated: singlePass | 0 |
2204 | // Under these conditions we can set the new stencil value in a single | - |
2205 | // pass, by using the current value and the "new value" as the toggles | - |
2206 | | - |
2207 | glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0203, referenceClipValue, ~GLuint(0x80)); | - |
2208 | glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x150A, 0x150A); | - |
2209 | glStencilMask(value ^ referenceClipValue); never executed (the execution status of this line is deduced): glStencilMask(value ^ referenceClipValue); | - |
2210 | | - |
2211 | drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); never executed (the execution status of this line is deduced): drawVertexArrays(vertexCoordinateArray, 0x0006); | - |
2212 | } else { | 0 |
2213 | glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); never executed (the execution status of this line is deduced): glStencilOp(0x1E00, 0x1E01, 0x1E01); | - |
2214 | glStencilMask(0xff); never executed (the execution status of this line is deduced): glStencilMask(0xff); | - |
2215 | | - |
2216 | if (!q->state()->clipTestEnabled && path.hasWindingFill()) { never evaluated: !q->state()->clipTestEnabled never evaluated: path.hasWindingFill() | 0 |
2217 | // Pass when any clip bit is set, set high bit | - |
2218 | glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0205, GLuint(0x80), ~GLuint(0x80)); | - |
2219 | composite(vertexCoordinateArray.boundingRect()); never executed (the execution status of this line is deduced): composite(vertexCoordinateArray.boundingRect()); | - |
2220 | } | 0 |
2221 | | - |
2222 | // Pass when high bit is set, replace stencil value with new clip value | - |
2223 | glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0205, value, GLuint(0x80)); | - |
2224 | | - |
2225 | composite(vertexCoordinateArray.boundingRect()); never executed (the execution status of this line is deduced): composite(vertexCoordinateArray.boundingRect()); | - |
2226 | } | 0 |
2227 | | - |
2228 | glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); never executed (the execution status of this line is deduced): glStencilFunc(0x0203, value, ~GLuint(0x80)); | - |
2229 | glStencilMask(0); never executed (the execution status of this line is deduced): glStencilMask(0); | - |
2230 | | - |
2231 | glColorMask(true, true, true, true); never executed (the execution status of this line is deduced): glColorMask(true, true, true, true); | - |
2232 | } | 0 |
2233 | | - |
2234 | void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) | - |
2235 | { | - |
2236 | // qDebug("QGL2PaintEngineEx::clip()"); | - |
2237 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
2238 | | - |
2239 | state()->clipChanged = true; never executed (the execution status of this line is deduced): state()->clipChanged = true; | - |
2240 | | - |
2241 | ensureActive(); never executed (the execution status of this line is deduced): ensureActive(); | - |
2242 | | - |
2243 | if (op == Qt::ReplaceClip) { never evaluated: op == Qt::ReplaceClip | 0 |
2244 | op = Qt::IntersectClip; never executed (the execution status of this line is deduced): op = Qt::IntersectClip; | - |
2245 | if (d->hasClipOperations()) { never evaluated: d->hasClipOperations() | 0 |
2246 | d->systemStateChanged(); never executed (the execution status of this line is deduced): d->systemStateChanged(); | - |
2247 | state()->canRestoreClip = false; never executed (the execution status of this line is deduced): state()->canRestoreClip = false; | - |
2248 | } | 0 |
2249 | } | 0 |
2250 | | - |
2251 | #ifndef QT_GL_NO_SCISSOR_TEST | - |
2252 | if (!path.isEmpty() && op == Qt::IntersectClip && (path.shape() == QVectorPath::RectangleHint)) { never evaluated: !path.isEmpty() never evaluated: op == Qt::IntersectClip never evaluated: (path.shape() == QVectorPath::RectangleHint) | 0 |
2253 | const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); never executed (the execution status of this line is deduced): const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); | - |
2254 | QRectF rect(points[0], points[2]); never executed (the execution status of this line is deduced): QRectF rect(points[0], points[2]); | - |
2255 | | - |
2256 | if (state()->matrix.type() <= QTransform::TxScale never evaluated: state()->matrix.type() <= QTransform::TxScale | 0 |
2257 | || (state()->matrix.type() == QTransform::TxRotate never evaluated: state()->matrix.type() == QTransform::TxRotate | 0 |
2258 | && qFuzzyIsNull(state()->matrix.m11()) never evaluated: qFuzzyIsNull(state()->matrix.m11()) | 0 |
2259 | && qFuzzyIsNull(state()->matrix.m22()))) never evaluated: qFuzzyIsNull(state()->matrix.m22()) | 0 |
2260 | { | - |
2261 | state()->rectangleClip = state()->rectangleClip.intersected(state()->matrix.mapRect(rect).toRect()); never executed (the execution status of this line is deduced): state()->rectangleClip = state()->rectangleClip.intersected(state()->matrix.mapRect(rect).toRect()); | - |
2262 | d->updateClipScissorTest(); never executed (the execution status of this line is deduced): d->updateClipScissorTest(); | - |
2263 | return; | 0 |
2264 | } | - |
2265 | } | 0 |
2266 | #endif | - |
2267 | | - |
2268 | const QRect pathRect = state()->matrix.mapRect(path.controlPointRect()).toAlignedRect(); never executed (the execution status of this line is deduced): const QRect pathRect = state()->matrix.mapRect(path.controlPointRect()).toAlignedRect(); | - |
2269 | | - |
2270 | switch (op) { | - |
2271 | case Qt::NoClip: | - |
2272 | if (d->useSystemClip) { never evaluated: d->useSystemClip | 0 |
2273 | state()->clipTestEnabled = true; never executed (the execution status of this line is deduced): state()->clipTestEnabled = true; | - |
2274 | state()->currentClip = 1; never executed (the execution status of this line is deduced): state()->currentClip = 1; | - |
2275 | } else { | 0 |
2276 | state()->clipTestEnabled = false; never executed (the execution status of this line is deduced): state()->clipTestEnabled = false; | - |
2277 | } | 0 |
2278 | state()->rectangleClip = QRect(0, 0, d->width, d->height); never executed (the execution status of this line is deduced): state()->rectangleClip = QRect(0, 0, d->width, d->height); | - |
2279 | state()->canRestoreClip = false; never executed (the execution status of this line is deduced): state()->canRestoreClip = false; | - |
2280 | d->updateClipScissorTest(); never executed (the execution status of this line is deduced): d->updateClipScissorTest(); | - |
2281 | break; | 0 |
2282 | case Qt::IntersectClip: | - |
2283 | state()->rectangleClip = state()->rectangleClip.intersected(pathRect); never executed (the execution status of this line is deduced): state()->rectangleClip = state()->rectangleClip.intersected(pathRect); | - |
2284 | d->updateClipScissorTest(); never executed (the execution status of this line is deduced): d->updateClipScissorTest(); | - |
2285 | d->resetClipIfNeeded(); never executed (the execution status of this line is deduced): d->resetClipIfNeeded(); | - |
2286 | ++d->maxClip; never executed (the execution status of this line is deduced): ++d->maxClip; | - |
2287 | d->writeClip(path, d->maxClip); never executed (the execution status of this line is deduced): d->writeClip(path, d->maxClip); | - |
2288 | state()->currentClip = d->maxClip; never executed (the execution status of this line is deduced): state()->currentClip = d->maxClip; | - |
2289 | state()->clipTestEnabled = true; never executed (the execution status of this line is deduced): state()->clipTestEnabled = true; | - |
2290 | break; | 0 |
2291 | default: | - |
2292 | break; | 0 |
2293 | } | - |
2294 | } | 0 |
2295 | | - |
2296 | void QGL2PaintEngineExPrivate::regenerateClip() | - |
2297 | { | - |
2298 | systemStateChanged(); never executed (the execution status of this line is deduced): systemStateChanged(); | - |
2299 | replayClipOperations(); never executed (the execution status of this line is deduced): replayClipOperations(); | - |
2300 | } | 0 |
2301 | | - |
2302 | void QGL2PaintEngineExPrivate::systemStateChanged() | - |
2303 | { | - |
2304 | Q_Q(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineEx * const q = q_func(); | - |
2305 | | - |
2306 | q->state()->clipChanged = true; never executed (the execution status of this line is deduced): q->state()->clipChanged = true; | - |
2307 | | - |
2308 | if (systemClip.isEmpty()) { never evaluated: systemClip.isEmpty() | 0 |
2309 | useSystemClip = false; never executed (the execution status of this line is deduced): useSystemClip = false; | - |
2310 | } else { | 0 |
2311 | if (q->paintDevice()->devType() == QInternal::Widget && currentClipDevice) { never evaluated: q->paintDevice()->devType() == QInternal::Widget never evaluated: currentClipDevice | 0 |
2312 | QWidgetPrivate *widgetPrivate = qt_widget_private(static_cast<QWidget *>(currentClipDevice)->window()); never executed (the execution status of this line is deduced): QWidgetPrivate *widgetPrivate = qt_widget_private(static_cast<QWidget *>(currentClipDevice)->window()); | - |
2313 | useSystemClip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter; never evaluated: widgetPrivate->extra never evaluated: widgetPrivate->extra->inRenderWithPainter | 0 |
2314 | } else { | 0 |
2315 | useSystemClip = true; never executed (the execution status of this line is deduced): useSystemClip = true; | - |
2316 | } | 0 |
2317 | } | - |
2318 | | - |
2319 | q->state()->clipTestEnabled = false; never executed (the execution status of this line is deduced): q->state()->clipTestEnabled = false; | - |
2320 | q->state()->needsClipBufferClear = true; never executed (the execution status of this line is deduced): q->state()->needsClipBufferClear = true; | - |
2321 | | - |
2322 | q->state()->currentClip = 1; never executed (the execution status of this line is deduced): q->state()->currentClip = 1; | - |
2323 | maxClip = 1; never executed (the execution status of this line is deduced): maxClip = 1; | - |
2324 | | - |
2325 | q->state()->rectangleClip = useSystemClip ? systemClip.boundingRect() : QRect(0, 0, width, height); never evaluated: useSystemClip | 0 |
2326 | updateClipScissorTest(); never executed (the execution status of this line is deduced): updateClipScissorTest(); | - |
2327 | | - |
2328 | if (systemClip.rectCount() == 1) { never evaluated: systemClip.rectCount() == 1 | 0 |
2329 | if (systemClip.boundingRect() == QRect(0, 0, width, height)) never evaluated: systemClip.boundingRect() == QRect(0, 0, width, height) | 0 |
2330 | useSystemClip = false; never executed: useSystemClip = false; | 0 |
2331 | #ifndef QT_GL_NO_SCISSOR_TEST | - |
2332 | // scissoring takes care of the system clip | - |
2333 | return; | 0 |
2334 | #endif | - |
2335 | } | - |
2336 | | - |
2337 | if (useSystemClip) { never evaluated: useSystemClip | 0 |
2338 | clearClip(0); never executed (the execution status of this line is deduced): clearClip(0); | - |
2339 | | - |
2340 | QPainterPath path; never executed (the execution status of this line is deduced): QPainterPath path; | - |
2341 | path.addRegion(systemClip); never executed (the execution status of this line is deduced): path.addRegion(systemClip); | - |
2342 | | - |
2343 | q->state()->currentClip = 0; never executed (the execution status of this line is deduced): q->state()->currentClip = 0; | - |
2344 | writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1); never executed (the execution status of this line is deduced): writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1); | - |
2345 | q->state()->currentClip = 1; never executed (the execution status of this line is deduced): q->state()->currentClip = 1; | - |
2346 | q->state()->clipTestEnabled = true; never executed (the execution status of this line is deduced): q->state()->clipTestEnabled = true; | - |
2347 | } | 0 |
2348 | } | 0 |
2349 | | - |
2350 | void QGL2PaintEngineEx::setState(QPainterState *new_state) | - |
2351 | { | - |
2352 | // qDebug("QGL2PaintEngineEx::setState()"); | - |
2353 | | - |
2354 | Q_D(QGL2PaintEngineEx); never executed (the execution status of this line is deduced): QGL2PaintEngineExPrivate * const d = d_func(); | - |
2355 | | - |
2356 | QOpenGL2PaintEngineState *s = static_cast<QOpenGL2PaintEngineState *>(new_state); never executed (the execution status of this line is deduced): QOpenGL2PaintEngineState *s = static_cast<QOpenGL2PaintEngineState *>(new_state); | - |
2357 | QOpenGL2PaintEngineState *old_state = state(); never executed (the execution status of this line is deduced): QOpenGL2PaintEngineState *old_state = state(); | - |
2358 | | - |
2359 | QPaintEngineEx::setState(s); never executed (the execution status of this line is deduced): QPaintEngineEx::setState(s); | - |
2360 | | - |
2361 | if (s->isNew) { never evaluated: s->isNew | 0 |
2362 | // Newly created state object. The call to setState() | - |
2363 | // will either be followed by a call to begin(), or we are | - |
2364 | // setting the state as part of a save(). | - |
2365 | s->isNew = false; never executed (the execution status of this line is deduced): s->isNew = false; | - |
2366 | return; | 0 |
2367 | } | - |
2368 | | - |
2369 | // Setting the state as part of a restore(). | - |
2370 | | - |
2371 | if (old_state == s || old_state->renderHintsChanged) never evaluated: old_state == s never evaluated: old_state->renderHintsChanged | 0 |
2372 | renderHintsChanged(); never executed: renderHintsChanged(); | 0 |
2373 | | - |
2374 | if (old_state == s || old_state->matrixChanged) never evaluated: old_state == s never evaluated: old_state->matrixChanged | 0 |
2375 | d->matrixDirty = true; never executed: d->matrixDirty = true; | 0 |
2376 | | - |
2377 | if (old_state == s || old_state->compositionModeChanged) never evaluated: old_state == s never evaluated: old_state->compositionModeChanged | 0 |
2378 | d->compositionModeDirty = true; never executed: d->compositionModeDirty = true; | 0 |
2379 | | - |
2380 | if (old_state == s || old_state->opacityChanged) never evaluated: old_state == s never evaluated: old_state->opacityChanged | 0 |
2381 | d->opacityUniformDirty = true; never executed: d->opacityUniformDirty = true; | 0 |
2382 | | - |
2383 | if (old_state == s || old_state->clipChanged) { never evaluated: old_state == s never evaluated: old_state->clipChanged | 0 |
2384 | if (old_state && old_state != s && old_state->canRestoreClip) { never evaluated: old_state never evaluated: old_state != s never evaluated: old_state->canRestoreClip | 0 |
2385 | d->updateClipScissorTest(); never executed (the execution status of this line is deduced): d->updateClipScissorTest(); | - |
2386 | glDepthFunc(GL_LEQUAL); never executed (the execution status of this line is deduced): glDepthFunc(0x0203); | - |
2387 | } else { | 0 |
2388 | d->regenerateClip(); never executed (the execution status of this line is deduced): d->regenerateClip(); | - |
2389 | } | 0 |
2390 | } | - |
2391 | } | 0 |
2392 | | - |
2393 | QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const | - |
2394 | { | - |
2395 | if (orig) | 0 |
2396 | const_cast<QGL2PaintEngineEx *>(this)->ensureActive(); never executed: const_cast<QGL2PaintEngineEx *>(this)->ensureActive(); | 0 |
2397 | | - |
2398 | QOpenGL2PaintEngineState *s; never executed (the execution status of this line is deduced): QOpenGL2PaintEngineState *s; | - |
2399 | if (!orig) | 0 |
2400 | s = new QOpenGL2PaintEngineState(); never executed: s = new QOpenGL2PaintEngineState(); | 0 |
2401 | else | - |
2402 | s = new QOpenGL2PaintEngineState(*static_cast<QOpenGL2PaintEngineState *>(orig)); never executed: s = new QOpenGL2PaintEngineState(*static_cast<QOpenGL2PaintEngineState *>(orig)); | 0 |
2403 | | - |
2404 | s->matrixChanged = false; never executed (the execution status of this line is deduced): s->matrixChanged = false; | - |
2405 | s->compositionModeChanged = false; never executed (the execution status of this line is deduced): s->compositionModeChanged = false; | - |
2406 | s->opacityChanged = false; never executed (the execution status of this line is deduced): s->opacityChanged = false; | - |
2407 | s->renderHintsChanged = false; never executed (the execution status of this line is deduced): s->renderHintsChanged = false; | - |
2408 | s->clipChanged = false; never executed (the execution status of this line is deduced): s->clipChanged = false; | - |
2409 | | - |
2410 | return s; never executed: return s; | 0 |
2411 | } | - |
2412 | | - |
2413 | QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other) | - |
2414 | : QPainterState(other) | - |
2415 | { | - |
2416 | isNew = true; never executed (the execution status of this line is deduced): isNew = true; | - |
2417 | needsClipBufferClear = other.needsClipBufferClear; never executed (the execution status of this line is deduced): needsClipBufferClear = other.needsClipBufferClear; | - |
2418 | clipTestEnabled = other.clipTestEnabled; never executed (the execution status of this line is deduced): clipTestEnabled = other.clipTestEnabled; | - |
2419 | currentClip = other.currentClip; never executed (the execution status of this line is deduced): currentClip = other.currentClip; | - |
2420 | canRestoreClip = other.canRestoreClip; never executed (the execution status of this line is deduced): canRestoreClip = other.canRestoreClip; | - |
2421 | rectangleClip = other.rectangleClip; never executed (the execution status of this line is deduced): rectangleClip = other.rectangleClip; | - |
2422 | } | 0 |
2423 | | - |
2424 | QOpenGL2PaintEngineState::QOpenGL2PaintEngineState() | - |
2425 | { | - |
2426 | isNew = true; never executed (the execution status of this line is deduced): isNew = true; | - |
2427 | needsClipBufferClear = true; never executed (the execution status of this line is deduced): needsClipBufferClear = true; | - |
2428 | clipTestEnabled = false; never executed (the execution status of this line is deduced): clipTestEnabled = false; | - |
2429 | canRestoreClip = true; never executed (the execution status of this line is deduced): canRestoreClip = true; | - |
2430 | } | 0 |
2431 | | - |
2432 | QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState() | - |
2433 | { | - |
2434 | } | - |
2435 | | - |
2436 | QT_END_NAMESPACE | - |
2437 | | - |
| | |