opengl/qopenglpaintengine.cpp

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

Generated by Squish Coco Non-Commercial