| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||||||||
| 14 | __attribute__((visibility("default"))) QImage qt_imageForBrush(int brushStyle, bool invert); | - | ||||||||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||||||||
| 18 | QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate() | - | ||||||||||||||||||||||||||||||
| 19 | { | - | ||||||||||||||||||||||||||||||
| 20 | delete shaderManager; | - | ||||||||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||||||||
| 22 | while (pathCaches.size()
| 0-1 | ||||||||||||||||||||||||||||||
| 23 | QVectorPath::CacheEntry *e = *(pathCaches.constBegin()); | - | ||||||||||||||||||||||||||||||
| 24 | e->cleanup(e->engine, e->data); | - | ||||||||||||||||||||||||||||||
| 25 | e->data = 0; | - | ||||||||||||||||||||||||||||||
| 26 | e->engine = 0; | - | ||||||||||||||||||||||||||||||
| 27 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||||||||
| 29 | if (elementIndicesVBOId != 0
| 0-1 | ||||||||||||||||||||||||||||||
| 30 | glDeleteBuffers(1, &elementIndicesVBOId); | - | ||||||||||||||||||||||||||||||
| 31 | elementIndicesVBOId = 0; | - | ||||||||||||||||||||||||||||||
| 32 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 33 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||||||||
| 35 | void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id) | - | ||||||||||||||||||||||||||||||
| 36 | { | - | ||||||||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||||||||
| 38 | if (id != GLuint(-1)
| 0 | ||||||||||||||||||||||||||||||
| 39 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||||||||
| 41 | lastTextureUsed = id; | - | ||||||||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||||||||
| 43 | if (smoothPixmapTransform
| 0 | ||||||||||||||||||||||||||||||
| 44 | glTexParameteri(target, 0x2800, 0x2601); | - | ||||||||||||||||||||||||||||||
| 45 | glTexParameteri(target, 0x2801, 0x2601); | - | ||||||||||||||||||||||||||||||
| 46 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 47 | glTexParameteri(target, 0x2800, 0x2600); | - | ||||||||||||||||||||||||||||||
| 48 | glTexParameteri(target, 0x2801, 0x2600); | - | ||||||||||||||||||||||||||||||
| 49 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 50 | glTexParameteri(target, 0x2802, wrapMode); | - | ||||||||||||||||||||||||||||||
| 51 | glTexParameteri(target, 0x2803, wrapMode); | - | ||||||||||||||||||||||||||||||
| 52 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||||||||
| 55 | inline QColor qt_premultiplyColor(QColor c, GLfloat opacity) | - | ||||||||||||||||||||||||||||||
| 56 | { | - | ||||||||||||||||||||||||||||||
| 57 | qreal alpha = c.alphaF() * opacity; | - | ||||||||||||||||||||||||||||||
| 58 | c.setAlphaF(alpha); | - | ||||||||||||||||||||||||||||||
| 59 | c.setRedF(c.redF() * alpha); | - | ||||||||||||||||||||||||||||||
| 60 | c.setGreenF(c.greenF() * alpha); | - | ||||||||||||||||||||||||||||||
| 61 | c.setBlueF(c.blueF() * alpha); | - | ||||||||||||||||||||||||||||||
| 62 | return executed 3 times by 1 test: c;return c;Executed by:
executed 3 times by 1 test: return c;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 63 | } | - | ||||||||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||||||||
| 66 | void QGL2PaintEngineExPrivate::setBrush(const QBrush& brush) | - | ||||||||||||||||||||||||||||||
| 67 | { | - | ||||||||||||||||||||||||||||||
| 68 | if (qbrush_fast_equals(currentBrush, brush)
| 3-39 | ||||||||||||||||||||||||||||||
| 69 | return; executed 39 times by 1 test: return;Executed by:
| 39 | ||||||||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||||||||
| 71 | const Qt::BrushStyle newStyle = qbrush_style(brush); | - | ||||||||||||||||||||||||||||||
| 72 | ((!(newStyle != Qt::NoBrush)) ? qt_assert("newStyle != Qt::NoBrush",__FILE__,152) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||||||||
| 74 | currentBrush = brush; | - | ||||||||||||||||||||||||||||||
| 75 | if (!currentBrushPixmap.isNull()
| 0-3 | ||||||||||||||||||||||||||||||
| 76 | currentBrushPixmap = QPixmap(); never executed: currentBrushPixmap = QPixmap(); | 0 | ||||||||||||||||||||||||||||||
| 77 | brushUniformsDirty = true; | - | ||||||||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||||||||
| 79 | if (newStyle > Qt::SolidPattern
| 0-3 | ||||||||||||||||||||||||||||||
| 80 | brushTextureDirty = true; never executed: brushTextureDirty = true; | 0 | ||||||||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||||||||
| 82 | if (currentBrush.style() == Qt::TexturePattern
| 0-3 | ||||||||||||||||||||||||||||||
| 83 | && qHasPixmapTexture(brush)
| 0 | ||||||||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||||||||
| 85 | shaderManager->setSrcPixelType(QGLEngineShaderManager::TextureSrcWithPattern); | - | ||||||||||||||||||||||||||||||
| 86 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 87 | shaderManager->setSrcPixelType(newStyle); | - | ||||||||||||||||||||||||||||||
| 88 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 89 | shaderManager->optimiseForBrushTransform(currentBrush.transform().type()); | - | ||||||||||||||||||||||||||||||
| 90 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||||||||
| 93 | void QGL2PaintEngineExPrivate::useSimpleShader() | - | ||||||||||||||||||||||||||||||
| 94 | { | - | ||||||||||||||||||||||||||||||
| 95 | shaderManager->useSimpleProgram(); | - | ||||||||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||||||||
| 97 | if (matrixDirty
| 0-6 | ||||||||||||||||||||||||||||||
| 98 | updateMatrix(); never executed: updateMatrix(); | 0 | ||||||||||||||||||||||||||||||
| 99 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||||||||
| 107 | void QGL2PaintEngineExPrivate::updateBrushTexture() | - | ||||||||||||||||||||||||||||||
| 108 | { | - | ||||||||||||||||||||||||||||||
| 109 | QGL2PaintEngineEx * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||||||||
| 111 | Qt::BrushStyle style = currentBrush.style(); | - | ||||||||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||||||||
| 113 | if ( (
| 0-3 | ||||||||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||||||||
| 115 | QImage texImage = qt_imageForBrush(style, false); | - | ||||||||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||||||||
| 117 | glActiveTexture(0x84C0 + GLuint(0)); | - | ||||||||||||||||||||||||||||||
| 118 | ctx->d_func()->bindTexture(texImage, 0x0DE1, 0x1908, QGLContext::InternalBindOption); | - | ||||||||||||||||||||||||||||||
| 119 | updateTextureFilter(0x0DE1, 0x2901, q->state()->renderHints & QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 121 | else if (style >= Qt::LinearGradientPattern
| 0-3 | ||||||||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||||||||
| 124 | const QGradient* g = currentBrush.gradient(); | - | ||||||||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||||||||
| 128 | GLuint texId = QGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0); | - | ||||||||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||||||||
| 130 | glActiveTexture(0x84C0 + GLuint(0)); | - | ||||||||||||||||||||||||||||||
| 131 | glBindTexture(0x0DE1, texId); | - | ||||||||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||||||||
| 133 | if (g->spread() == QGradient::RepeatSpread
| 0 | ||||||||||||||||||||||||||||||
| 134 | updateTextureFilter(0x0DE1, 0x2901, q->state()->renderHints & QPainter::SmoothPixmapTransform); never executed: updateTextureFilter(0x0DE1, 0x2901, q->state()->renderHints & QPainter::SmoothPixmapTransform); | 0 | ||||||||||||||||||||||||||||||
| 135 | else if (g->spread() == QGradient::ReflectSpread
| 0 | ||||||||||||||||||||||||||||||
| 136 | updateTextureFilter(0x0DE1, 0x8370, q->state()->renderHints & QPainter::SmoothPixmapTransform); never executed: updateTextureFilter(0x0DE1, 0x8370, q->state()->renderHints & QPainter::SmoothPixmapTransform); | 0 | ||||||||||||||||||||||||||||||
| 137 | else | - | ||||||||||||||||||||||||||||||
| 138 | updateTextureFilter(0x0DE1, 0x812F, q->state()->renderHints & QPainter::SmoothPixmapTransform); never executed: updateTextureFilter(0x0DE1, 0x812F, q->state()->renderHints & QPainter::SmoothPixmapTransform); | 0 | ||||||||||||||||||||||||||||||
| 139 | } | - | ||||||||||||||||||||||||||||||
| 140 | else if (style == Qt::TexturePattern
| 0-3 | ||||||||||||||||||||||||||||||
| 141 | currentBrushPixmap = currentBrush.texture(); | - | ||||||||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||||||||
| 143 | int max_texture_size = ctx->d_func()->maxTextureSize(); | - | ||||||||||||||||||||||||||||||
| 144 | if (currentBrushPixmap.width() > max_texture_size
| 0 | ||||||||||||||||||||||||||||||
| 145 | 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 | ||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||
| 147 | GLuint wrapMode = 0x2901; | - | ||||||||||||||||||||||||||||||
| 148 | if (ctx->contextHandle()->isOpenGLES()
| 0 | ||||||||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||||||||
| 152 | wrapMode = 0x812F; | - | ||||||||||||||||||||||||||||||
| 153 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||||||||
| 155 | glActiveTexture(0x84C0 + GLuint(0)); | - | ||||||||||||||||||||||||||||||
| 156 | QGLTexture *tex = ctx->d_func()->bindTexture(currentBrushPixmap, 0x0DE1, 0x1908, | - | ||||||||||||||||||||||||||||||
| 157 | QGLContext::InternalBindOption | | - | ||||||||||||||||||||||||||||||
| 158 | QGLContext::CanFlipNativePixmapBindOption); | - | ||||||||||||||||||||||||||||||
| 159 | updateTextureFilter(0x0DE1, wrapMode, q->state()->renderHints & QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||
| 160 | textureInvertedY = tex->options & QGLContext::InvertedYBindOption
| 0 | ||||||||||||||||||||||||||||||
| 161 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 162 | brushTextureDirty = false; | - | ||||||||||||||||||||||||||||||
| 163 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||||||||
| 166 | void QGL2PaintEngineExPrivate::updateBrushUniforms() | - | ||||||||||||||||||||||||||||||
| 167 | { | - | ||||||||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||||||||
| 169 | Qt::BrushStyle style = currentBrush.style(); | - | ||||||||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||||||||
| 171 | if (style == Qt::NoBrush
| 0-3 | ||||||||||||||||||||||||||||||
| 172 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||
| 174 | QTransform brushQTransform = currentBrush.transform(); | - | ||||||||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||||||||
| 176 | if (style == Qt::SolidPattern
| 0-3 | ||||||||||||||||||||||||||||||
| 177 | QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); | - | ||||||||||||||||||||||||||||||
| 178 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::FragmentColor), col); | - | ||||||||||||||||||||||||||||||
| 179 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 180 | else { | - | ||||||||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||||||||
| 182 | QPointF translationPoint; | - | ||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||
| 184 | if (style <= Qt::DiagCrossPattern
| 0 | ||||||||||||||||||||||||||||||
| 185 | QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); | - | ||||||||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||||||||
| 187 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); | - | ||||||||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||||||||
| 189 | QVector2D halfViewportSize(width*0.5, height*0.5); | - | ||||||||||||||||||||||||||||||
| 190 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - | ||||||||||||||||||||||||||||||
| 191 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 192 | else if (style == Qt::LinearGradientPattern
| 0 | ||||||||||||||||||||||||||||||
| 193 | const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush.gradient()); | - | ||||||||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||||||||
| 195 | QPointF realStart = g->start(); | - | ||||||||||||||||||||||||||||||
| 196 | QPointF realFinal = g->finalStop(); | - | ||||||||||||||||||||||||||||||
| 197 | translationPoint = realStart; | - | ||||||||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||||||||
| 199 | QPointF l = realFinal - realStart; | - | ||||||||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||||||||
| 201 | QVector3D linearData( | - | ||||||||||||||||||||||||||||||
| 202 | l.x(), | - | ||||||||||||||||||||||||||||||
| 203 | l.y(), | - | ||||||||||||||||||||||||||||||
| 204 | 1.0f / (l.x() * l.x() + l.y() * l.y()) | - | ||||||||||||||||||||||||||||||
| 205 | ); | - | ||||||||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||||||||
| 207 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::LinearData), linearData); | - | ||||||||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||||||||
| 209 | QVector2D halfViewportSize(width*0.5, height*0.5); | - | ||||||||||||||||||||||||||||||
| 210 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - | ||||||||||||||||||||||||||||||
| 211 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 212 | else if (style == Qt::ConicalGradientPattern
| 0 | ||||||||||||||||||||||||||||||
| 213 | const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush.gradient()); | - | ||||||||||||||||||||||||||||||
| 214 | translationPoint = g->center(); | - | ||||||||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||||||||
| 216 | GLfloat angle = -qDegreesToRadians(g->angle()); | - | ||||||||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||||||||
| 218 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Angle), angle); | - | ||||||||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||||||||
| 220 | QVector2D halfViewportSize(width*0.5, height*0.5); | - | ||||||||||||||||||||||||||||||
| 221 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - | ||||||||||||||||||||||||||||||
| 222 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 223 | else if (style == Qt::RadialGradientPattern
| 0 | ||||||||||||||||||||||||||||||
| 224 | const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush.gradient()); | - | ||||||||||||||||||||||||||||||
| 225 | QPointF realCenter = g->center(); | - | ||||||||||||||||||||||||||||||
| 226 | QPointF realFocal = g->focalPoint(); | - | ||||||||||||||||||||||||||||||
| 227 | qreal realRadius = g->centerRadius() - g->focalRadius(); | - | ||||||||||||||||||||||||||||||
| 228 | translationPoint = realFocal; | - | ||||||||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||||||||
| 230 | QPointF fmp = realCenter - realFocal; | - | ||||||||||||||||||||||||||||||
| 231 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp), fmp); | - | ||||||||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||||||||
| 233 | GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius; | - | ||||||||||||||||||||||||||||||
| 234 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp2MRadius2), fmp2_m_radius2); | - | ||||||||||||||||||||||||||||||
| 235 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Inverse2Fmp2MRadius2), | - | ||||||||||||||||||||||||||||||
| 236 | GLfloat(1.0 / (2.0*fmp2_m_radius2))); | - | ||||||||||||||||||||||||||||||
| 237 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::SqrFr), | - | ||||||||||||||||||||||||||||||
| 238 | GLfloat(g->focalRadius() * g->focalRadius())); | - | ||||||||||||||||||||||||||||||
| 239 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BRadius), | - | ||||||||||||||||||||||||||||||
| 240 | GLfloat(2 * (g->centerRadius() - g->focalRadius()) * g->focalRadius()), | - | ||||||||||||||||||||||||||||||
| 241 | g->focalRadius(), | - | ||||||||||||||||||||||||||||||
| 242 | g->centerRadius() - g->focalRadius()); | - | ||||||||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||||||||
| 244 | QVector2D halfViewportSize(width*0.5, height*0.5); | - | ||||||||||||||||||||||||||||||
| 245 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - | ||||||||||||||||||||||||||||||
| 246 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 247 | else if (style == Qt::TexturePattern
| 0 | ||||||||||||||||||||||||||||||
| 248 | const QPixmap& texPixmap = currentBrush.texture(); | - | ||||||||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||||||||
| 250 | if (qHasPixmapTexture(currentBrush)
| 0 | ||||||||||||||||||||||||||||||
| 251 | QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); | - | ||||||||||||||||||||||||||||||
| 252 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); | - | ||||||||||||||||||||||||||||||
| 253 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||||||||
| 255 | QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 / texPixmap.height()); | - | ||||||||||||||||||||||||||||||
| 256 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); | - | ||||||||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||||||||
| 258 | QVector2D halfViewportSize(width*0.5, height*0.5); | - | ||||||||||||||||||||||||||||||
| 259 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); | - | ||||||||||||||||||||||||||||||
| 260 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 261 | else | - | ||||||||||||||||||||||||||||||
| 262 | QMessageLogger(__FILE__, 342, __PRETTY_FUNCTION__).warning("QGL2PaintEngineEx: Unimplemented fill style"); never executed: QMessageLogger(__FILE__, 342, __PRETTY_FUNCTION__).warning("QGL2PaintEngineEx: Unimplemented fill style"); | 0 | ||||||||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||||||||
| 264 | const QPointF &brushOrigin = q->state()->brushOrigin; | - | ||||||||||||||||||||||||||||||
| 265 | QTransform matrix = q->state()->matrix; | - | ||||||||||||||||||||||||||||||
| 266 | matrix.translate(brushOrigin.x(), brushOrigin.y()); | - | ||||||||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||||||||
| 268 | QTransform translate(1, 0, 0, 1, -translationPoint.x(), -translationPoint.y()); | - | ||||||||||||||||||||||||||||||
| 269 | qreal m22 = -1; | - | ||||||||||||||||||||||||||||||
| 270 | qreal dy = height; | - | ||||||||||||||||||||||||||||||
| 271 | if (device->isFlipped()
| 0 | ||||||||||||||||||||||||||||||
| 272 | m22 = 1; | - | ||||||||||||||||||||||||||||||
| 273 | dy = 0; | - | ||||||||||||||||||||||||||||||
| 274 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 275 | QTransform gl_to_qt(1, 0, 0, m22, 0, dy); | - | ||||||||||||||||||||||||||||||
| 276 | QTransform inv_matrix; | - | ||||||||||||||||||||||||||||||
| 277 | if (style == Qt::TexturePattern
| 0 | ||||||||||||||||||||||||||||||
| 278 | 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 | ||||||||||||||||||||||||||||||
| 279 | else | - | ||||||||||||||||||||||||||||||
| 280 | inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate; never executed: inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate; | 0 | ||||||||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||||||||
| 282 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTransform), inv_matrix); | - | ||||||||||||||||||||||||||||||
| 283 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTexture), GLuint(0)); | - | ||||||||||||||||||||||||||||||
| 284 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 285 | brushUniformsDirty = false; | - | ||||||||||||||||||||||||||||||
| 286 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||||||||
| 290 | void QGL2PaintEngineExPrivate::updateMatrix() | - | ||||||||||||||||||||||||||||||
| 291 | { | - | ||||||||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||||||||
| 294 | const QTransform& transform = q->state()->matrix; | - | ||||||||||||||||||||||||||||||
| 295 | const GLfloat wfactor = 2.0f / width; | - | ||||||||||||||||||||||||||||||
| 296 | GLfloat hfactor = -2.0f / height; | - | ||||||||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||||||||
| 298 | GLfloat dx = transform.dx(); | - | ||||||||||||||||||||||||||||||
| 299 | GLfloat dy = transform.dy(); | - | ||||||||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||||||||
| 301 | if (device->isFlipped()
| 0-3 | ||||||||||||||||||||||||||||||
| 302 | hfactor *= -1; | - | ||||||||||||||||||||||||||||||
| 303 | dy -= height; | - | ||||||||||||||||||||||||||||||
| 304 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||||||||
| 308 | if (snapToPixelGrid
| 0-3 | ||||||||||||||||||||||||||||||
| 309 | - | |||||||||||||||||||||||||||||||
| 310 | dx = std::ceil(dx - 0.5f); | - | ||||||||||||||||||||||||||||||
| 311 | dy = std::ceil(dy - 0.5f); | - | ||||||||||||||||||||||||||||||
| 312 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 313 | pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13(); | - | ||||||||||||||||||||||||||||||
| 314 | pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23(); | - | ||||||||||||||||||||||||||||||
| 315 | pmvMatrix[2][0] = (wfactor * dx) - transform.m33(); | - | ||||||||||||||||||||||||||||||
| 316 | pmvMatrix[0][1] = (hfactor * transform.m12()) + transform.m13(); | - | ||||||||||||||||||||||||||||||
| 317 | pmvMatrix[1][1] = (hfactor * transform.m22()) + transform.m23(); | - | ||||||||||||||||||||||||||||||
| 318 | pmvMatrix[2][1] = (hfactor * dy) + transform.m33(); | - | ||||||||||||||||||||||||||||||
| 319 | pmvMatrix[0][2] = transform.m13(); | - | ||||||||||||||||||||||||||||||
| 320 | pmvMatrix[1][2] = transform.m23(); | - | ||||||||||||||||||||||||||||||
| 321 | pmvMatrix[2][2] = transform.m33(); | - | ||||||||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||||||||
| 325 | inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())), | - | ||||||||||||||||||||||||||||||
| 326 | qMax(qAbs(transform.m12()), qAbs(transform.m21())) ), | - | ||||||||||||||||||||||||||||||
| 327 | qreal(0.0001)); | - | ||||||||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||||||||
| 329 | matrixDirty = false; | - | ||||||||||||||||||||||||||||||
| 330 | matrixUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||||||||
| 334 | glVertexAttrib3fv(QT_PMV_MATRIX_1_ATTR, pmvMatrix[0]); | - | ||||||||||||||||||||||||||||||
| 335 | glVertexAttrib3fv(QT_PMV_MATRIX_2_ATTR, pmvMatrix[1]); | - | ||||||||||||||||||||||||||||||
| 336 | glVertexAttrib3fv(QT_PMV_MATRIX_3_ATTR, pmvMatrix[2]); | - | ||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||
| 338 | dasher.setInvScale(inverseScale); | - | ||||||||||||||||||||||||||||||
| 339 | stroker.setInvScale(inverseScale); | - | ||||||||||||||||||||||||||||||
| 340 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||||||||
| 343 | void QGL2PaintEngineExPrivate::updateCompositionMode() | - | ||||||||||||||||||||||||||||||
| 344 | { | - | ||||||||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||||||||
| 348 | switch(q->state()->composition_mode) { | - | ||||||||||||||||||||||||||||||
| 349 | case executed 3 times by 1 test: QPainter::CompositionMode_SourceOver:case QPainter::CompositionMode_SourceOver:Executed by:
executed 3 times by 1 test: case QPainter::CompositionMode_SourceOver:Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 350 | glBlendFunc(1, 0x0303); | - | ||||||||||||||||||||||||||||||
| 351 | break; executed 3 times by 1 test: break;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 352 | case never executed: QPainter::CompositionMode_DestinationOver:case QPainter::CompositionMode_DestinationOver:never executed: case QPainter::CompositionMode_DestinationOver: | 0 | ||||||||||||||||||||||||||||||
| 353 | glBlendFunc(0x0305, 1); | - | ||||||||||||||||||||||||||||||
| 354 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 355 | case never executed: QPainter::CompositionMode_Clear:case QPainter::CompositionMode_Clear:never executed: case QPainter::CompositionMode_Clear: | 0 | ||||||||||||||||||||||||||||||
| 356 | glBlendFunc(0, 0); | - | ||||||||||||||||||||||||||||||
| 357 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 358 | case never executed: QPainter::CompositionMode_Source:case QPainter::CompositionMode_Source:never executed: case QPainter::CompositionMode_Source: | 0 | ||||||||||||||||||||||||||||||
| 359 | glBlendFunc(1, 0); | - | ||||||||||||||||||||||||||||||
| 360 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 361 | case never executed: QPainter::CompositionMode_Destination:case QPainter::CompositionMode_Destination:never executed: case QPainter::CompositionMode_Destination: | 0 | ||||||||||||||||||||||||||||||
| 362 | glBlendFunc(0, 1); | - | ||||||||||||||||||||||||||||||
| 363 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 364 | case never executed: QPainter::CompositionMode_SourceIn:case QPainter::CompositionMode_SourceIn:never executed: case QPainter::CompositionMode_SourceIn: | 0 | ||||||||||||||||||||||||||||||
| 365 | glBlendFunc(0x0304, 0); | - | ||||||||||||||||||||||||||||||
| 366 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 367 | case never executed: QPainter::CompositionMode_DestinationIn:case QPainter::CompositionMode_DestinationIn:never executed: case QPainter::CompositionMode_DestinationIn: | 0 | ||||||||||||||||||||||||||||||
| 368 | glBlendFunc(0, 0x0302); | - | ||||||||||||||||||||||||||||||
| 369 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 370 | case never executed: QPainter::CompositionMode_SourceOut:case QPainter::CompositionMode_SourceOut:never executed: case QPainter::CompositionMode_SourceOut: | 0 | ||||||||||||||||||||||||||||||
| 371 | glBlendFunc(0x0305, 0); | - | ||||||||||||||||||||||||||||||
| 372 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 373 | case never executed: QPainter::CompositionMode_DestinationOut:case QPainter::CompositionMode_DestinationOut:never executed: case QPainter::CompositionMode_DestinationOut: | 0 | ||||||||||||||||||||||||||||||
| 374 | glBlendFunc(0, 0x0303); | - | ||||||||||||||||||||||||||||||
| 375 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 376 | case never executed: QPainter::CompositionMode_SourceAtop:case QPainter::CompositionMode_SourceAtop:never executed: case QPainter::CompositionMode_SourceAtop: | 0 | ||||||||||||||||||||||||||||||
| 377 | glBlendFunc(0x0304, 0x0303); | - | ||||||||||||||||||||||||||||||
| 378 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 379 | case never executed: QPainter::CompositionMode_DestinationAtop:case QPainter::CompositionMode_DestinationAtop:never executed: case QPainter::CompositionMode_DestinationAtop: | 0 | ||||||||||||||||||||||||||||||
| 380 | glBlendFunc(0x0305, 0x0302); | - | ||||||||||||||||||||||||||||||
| 381 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 382 | case never executed: QPainter::CompositionMode_Xor:case QPainter::CompositionMode_Xor:never executed: case QPainter::CompositionMode_Xor: | 0 | ||||||||||||||||||||||||||||||
| 383 | glBlendFunc(0x0305, 0x0303); | - | ||||||||||||||||||||||||||||||
| 384 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 385 | case never executed: QPainter::CompositionMode_Plus:case QPainter::CompositionMode_Plus:never executed: case QPainter::CompositionMode_Plus: | 0 | ||||||||||||||||||||||||||||||
| 386 | glBlendFunc(1, 1); | - | ||||||||||||||||||||||||||||||
| 387 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 388 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 389 | QMessageLogger(__FILE__, 487, __PRETTY_FUNCTION__).warning("Unsupported composition mode"); | - | ||||||||||||||||||||||||||||||
| 390 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 391 | } | - | ||||||||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||||||||
| 393 | compositionModeDirty = false; | - | ||||||||||||||||||||||||||||||
| 394 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 395 | - | |||||||||||||||||||||||||||||||
| 396 | static inline void setCoords(GLfloat *coords, const QGLRect &rect) | - | ||||||||||||||||||||||||||||||
| 397 | { | - | ||||||||||||||||||||||||||||||
| 398 | coords[0] = rect.left; | - | ||||||||||||||||||||||||||||||
| 399 | coords[1] = rect.top; | - | ||||||||||||||||||||||||||||||
| 400 | coords[2] = rect.right; | - | ||||||||||||||||||||||||||||||
| 401 | coords[3] = rect.top; | - | ||||||||||||||||||||||||||||||
| 402 | coords[4] = rect.right; | - | ||||||||||||||||||||||||||||||
| 403 | coords[5] = rect.bottom; | - | ||||||||||||||||||||||||||||||
| 404 | coords[6] = rect.left; | - | ||||||||||||||||||||||||||||||
| 405 | coords[7] = rect.bottom; | - | ||||||||||||||||||||||||||||||
| 406 | } executed 45 times by 1 test: end of blockExecuted by:
| 45 | ||||||||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||||||||
| 408 | void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern) | - | ||||||||||||||||||||||||||||||
| 409 | { | - | ||||||||||||||||||||||||||||||
| 410 | - | |||||||||||||||||||||||||||||||
| 411 | currentBrush = noBrush; | - | ||||||||||||||||||||||||||||||
| 412 | shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc); | - | ||||||||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||||||||
| 414 | if (snapToPixelGrid
| 0 | ||||||||||||||||||||||||||||||
| 415 | snapToPixelGrid = false; | - | ||||||||||||||||||||||||||||||
| 416 | matrixDirty = true; | - | ||||||||||||||||||||||||||||||
| 417 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||||||||
| 419 | if (prepareForDraw(opaque)
| 0 | ||||||||||||||||||||||||||||||
| 420 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), GLuint(0)); never executed: shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), GLuint(0)); | 0 | ||||||||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||||||||
| 422 | if (pattern
| 0 | ||||||||||||||||||||||||||||||
| 423 | QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); | - | ||||||||||||||||||||||||||||||
| 424 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); | - | ||||||||||||||||||||||||||||||
| 425 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||||||||
| 427 | GLfloat dx = 1.0 / textureSize.width(); | - | ||||||||||||||||||||||||||||||
| 428 | GLfloat dy = 1.0 / textureSize.height(); | - | ||||||||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||||||||
| 430 | QGLRect srcTextureRect(src.left*dx, src.top*dy, src.right*dx, src.bottom*dy); | - | ||||||||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||||||||
| 432 | setCoords(staticVertexCoordinateArray, dest); | - | ||||||||||||||||||||||||||||||
| 433 | setCoords(staticTextureCoordinateArray, srcTextureRect); | - | ||||||||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||||||||
| 435 | glDrawArrays(0x0006, 0, 4); | - | ||||||||||||||||||||||||||||||
| 436 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||||||||
| 438 | void QGL2PaintEngineEx::beginNativePainting() | - | ||||||||||||||||||||||||||||||
| 439 | { | - | ||||||||||||||||||||||||||||||
| 440 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 441 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 442 | d->transferMode(BrushDrawingMode); | - | ||||||||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||||||||
| 444 | d->nativePaintingActive = true; | - | ||||||||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||||||||
| 446 | d->glUseProgram(0); | - | ||||||||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||||||||
| 449 | for (int i = 0; i < 3
| 0 | ||||||||||||||||||||||||||||||
| 450 | d->glDisableVertexAttribArray(i); never executed: d->glDisableVertexAttribArray(i); | 0 | ||||||||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||||||||
| 453 | if (!d->ctx->contextHandle()->isOpenGLES()
| 0 | ||||||||||||||||||||||||||||||
| 454 | const QGLContext *ctx = d->ctx; | - | ||||||||||||||||||||||||||||||
| 455 | const QGLFormat &fmt = d->device->format(); | - | ||||||||||||||||||||||||||||||
| 456 | if (fmt.majorVersion() < 3
| 0 | ||||||||||||||||||||||||||||||
| 457 | || (fmt.majorVersion() == 3
| 0 | ||||||||||||||||||||||||||||||
| 458 | || fmt.profile() == QGLFormat::CompatibilityProfile
| 0 | ||||||||||||||||||||||||||||||
| 459 | { | - | ||||||||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||||||||
| 461 | - | |||||||||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||||||||
| 463 | const QTransform& mtx = state()->matrix; | - | ||||||||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||||||||
| 465 | float mv_matrix[4][4] = | - | ||||||||||||||||||||||||||||||
| 466 | { | - | ||||||||||||||||||||||||||||||
| 467 | { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) }, | - | ||||||||||||||||||||||||||||||
| 468 | { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) }, | - | ||||||||||||||||||||||||||||||
| 469 | { 0, 0, 1, 0 }, | - | ||||||||||||||||||||||||||||||
| 470 | { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) } | - | ||||||||||||||||||||||||||||||
| 471 | }; | - | ||||||||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||||||||
| 473 | const QSize sz = d->device->size(); | - | ||||||||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||||||||
| 475 | QOpenGLFunctions_1_1 *gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_1>(); | - | ||||||||||||||||||||||||||||||
| 476 | gl1funcs->initializeOpenGLFunctions(); | - | ||||||||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||||||||
| 478 | gl1funcs->glMatrixMode(0x1701); | - | ||||||||||||||||||||||||||||||
| 479 | gl1funcs->glLoadIdentity(); | - | ||||||||||||||||||||||||||||||
| 480 | gl1funcs->glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999); | - | ||||||||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||||||||
| 482 | gl1funcs->glMatrixMode(0x1700); | - | ||||||||||||||||||||||||||||||
| 483 | gl1funcs->glLoadMatrixf(&mv_matrix[0][0]); | - | ||||||||||||||||||||||||||||||
| 484 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 485 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||||||||
| 487 | - | |||||||||||||||||||||||||||||||
| 488 | d->lastTextureUsed = GLuint(-1); | - | ||||||||||||||||||||||||||||||
| 489 | d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); | - | ||||||||||||||||||||||||||||||
| 490 | d->resetGLState(); | - | ||||||||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||||||||
| 492 | d->shaderManager->setDirty(); | - | ||||||||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||||||||
| 494 | d->needsSync = true; | - | ||||||||||||||||||||||||||||||
| 495 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||||||||
| 497 | void QGL2PaintEngineExPrivate::resetGLState() | - | ||||||||||||||||||||||||||||||
| 498 | { | - | ||||||||||||||||||||||||||||||
| 499 | glDisable(0x0BE2); | - | ||||||||||||||||||||||||||||||
| 500 | glActiveTexture(0x84C0); | - | ||||||||||||||||||||||||||||||
| 501 | glDisable(0x0B90); | - | ||||||||||||||||||||||||||||||
| 502 | glDisable(0x0B71); | - | ||||||||||||||||||||||||||||||
| 503 | glDisable(0x0C11); | - | ||||||||||||||||||||||||||||||
| 504 | glDepthMask(true); | - | ||||||||||||||||||||||||||||||
| 505 | glDepthFunc(0x0201); | - | ||||||||||||||||||||||||||||||
| 506 | glClearDepthf(1); | - | ||||||||||||||||||||||||||||||
| 507 | glStencilMask(0xff); | - | ||||||||||||||||||||||||||||||
| 508 | glStencilOp(0x1E00, 0x1E00, 0x1E00); | - | ||||||||||||||||||||||||||||||
| 509 | glStencilFunc(0x0207, 0, 0xff); | - | ||||||||||||||||||||||||||||||
| 510 | ctx->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false); | - | ||||||||||||||||||||||||||||||
| 511 | ctx->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false); | - | ||||||||||||||||||||||||||||||
| 512 | ctx->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); | - | ||||||||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||||||||
| 514 | if (!ctx->contextHandle()->isOpenGLES()
| 0-3 | ||||||||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||||||||
| 516 | float color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | - | ||||||||||||||||||||||||||||||
| 517 | glVertexAttrib4fv(3, color); | - | ||||||||||||||||||||||||||||||
| 518 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||||||||
| 520 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||||||||
| 522 | bool QGL2PaintEngineExPrivate::resetOpenGLContextActiveEngine() | - | ||||||||||||||||||||||||||||||
| 523 | { | - | ||||||||||||||||||||||||||||||
| 524 | QOpenGLContext *guiGlContext = ctx->contextHandle(); | - | ||||||||||||||||||||||||||||||
| 525 | QOpenGLContextPrivate *guiGlContextPrivate = | - | ||||||||||||||||||||||||||||||
| 526 | guiGlContext
| 0-48 | ||||||||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||||||||
| 528 | if (guiGlContextPrivate
| 0-48 | ||||||||||||||||||||||||||||||
| 529 | ctx->d_func()->refreshCurrentFbo(); | - | ||||||||||||||||||||||||||||||
| 530 | guiGlContextPrivate->active_engine = 0; | - | ||||||||||||||||||||||||||||||
| 531 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 532 | } | - | ||||||||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||||||||
| 534 | return executed 48 times by 1 test: false;return false;Executed by:
executed 48 times by 1 test: return false;Executed by:
| 48 | ||||||||||||||||||||||||||||||
| 535 | } | - | ||||||||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||||||||
| 537 | void QGL2PaintEngineEx::endNativePainting() | - | ||||||||||||||||||||||||||||||
| 538 | { | - | ||||||||||||||||||||||||||||||
| 539 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 540 | d->needsSync = true; | - | ||||||||||||||||||||||||||||||
| 541 | d->nativePaintingActive = false; | - | ||||||||||||||||||||||||||||||
| 542 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 543 | - | |||||||||||||||||||||||||||||||
| 544 | void QGL2PaintEngineEx::invalidateState() | - | ||||||||||||||||||||||||||||||
| 545 | { | - | ||||||||||||||||||||||||||||||
| 546 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 547 | d->needsSync = true; | - | ||||||||||||||||||||||||||||||
| 548 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||||||||
| 550 | bool QGL2PaintEngineEx::isNativePaintingActive() const { | - | ||||||||||||||||||||||||||||||
| 551 | const QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 552 | return never executed: d->nativePaintingActive;return d->nativePaintingActive;never executed: return d->nativePaintingActive; | 0 | ||||||||||||||||||||||||||||||
| 553 | } | - | ||||||||||||||||||||||||||||||
| 554 | - | |||||||||||||||||||||||||||||||
| 555 | bool QGL2PaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &t) const | - | ||||||||||||||||||||||||||||||
| 556 | { | - | ||||||||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||||||||
| 558 | if (t.type() == QTransform::TxProject
| 0 | ||||||||||||||||||||||||||||||
| 559 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 560 | - | |||||||||||||||||||||||||||||||
| 561 | - | |||||||||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||||||||
| 564 | if (!fontEngine->supportsTransformation(t)
| 0 | ||||||||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||||||||
| 569 | float det = t.determinant(); | - | ||||||||||||||||||||||||||||||
| 570 | if (det >= 0.25f
| 0 | ||||||||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||||||||
| 572 | return never executed: QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t);return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t);never executed: return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t); | 0 | ||||||||||||||||||||||||||||||
| 573 | } | - | ||||||||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||||||||
| 575 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 576 | } | - | ||||||||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||||||||
| 578 | return never executed: QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t);return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t);never executed: return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t); | 0 | ||||||||||||||||||||||||||||||
| 579 | } | - | ||||||||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||||||||
| 581 | void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) | - | ||||||||||||||||||||||||||||||
| 582 | { | - | ||||||||||||||||||||||||||||||
| 583 | if (newMode == mode
| 0-51 | ||||||||||||||||||||||||||||||
| 584 | return; executed 51 times by 1 test: return;Executed by:
| 51 | ||||||||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||||||||
| 586 | if (mode == TextDrawingMode
| 0 | ||||||||||||||||||||||||||||||
| 587 | lastTextureUsed = GLuint(-1); | - | ||||||||||||||||||||||||||||||
| 588 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||||||||
| 590 | if (newMode == TextDrawingMode
| 0 | ||||||||||||||||||||||||||||||
| 591 | shaderManager->setHasComplexGeometry(true); | - | ||||||||||||||||||||||||||||||
| 592 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 593 | shaderManager->setHasComplexGeometry(false); | - | ||||||||||||||||||||||||||||||
| 594 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 595 | - | |||||||||||||||||||||||||||||||
| 596 | if (newMode == ImageDrawingMode
| 0 | ||||||||||||||||||||||||||||||
| 597 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); | - | ||||||||||||||||||||||||||||||
| 598 | setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray); | - | ||||||||||||||||||||||||||||||
| 599 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||||||||
| 601 | if (newMode == ImageArrayDrawingMode
| 0 | ||||||||||||||||||||||||||||||
| 602 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); | - | ||||||||||||||||||||||||||||||
| 603 | setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); | - | ||||||||||||||||||||||||||||||
| 604 | setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data()); | - | ||||||||||||||||||||||||||||||
| 605 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 606 | - | |||||||||||||||||||||||||||||||
| 607 | - | |||||||||||||||||||||||||||||||
| 608 | if (newMode != TextDrawingMode
| 0 | ||||||||||||||||||||||||||||||
| 609 | shaderManager->setMaskType(QGLEngineShaderManager::NoMask); never executed: shaderManager->setMaskType(QGLEngineShaderManager::NoMask); | 0 | ||||||||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||||||||
| 611 | mode = newMode; | - | ||||||||||||||||||||||||||||||
| 612 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 613 | - | |||||||||||||||||||||||||||||||
| 614 | struct QGL2PEVectorPathCache | - | ||||||||||||||||||||||||||||||
| 615 | { | - | ||||||||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||||||||
| 619 | - | |||||||||||||||||||||||||||||||
| 620 | float *vertices; | - | ||||||||||||||||||||||||||||||
| 621 | void *indices; | - | ||||||||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||||||||
| 623 | int vertexCount; | - | ||||||||||||||||||||||||||||||
| 624 | int indexCount; | - | ||||||||||||||||||||||||||||||
| 625 | GLenum primitiveType; | - | ||||||||||||||||||||||||||||||
| 626 | qreal iscale; | - | ||||||||||||||||||||||||||||||
| 627 | QVertexIndexVector::Type indexType; | - | ||||||||||||||||||||||||||||||
| 628 | }; | - | ||||||||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||||||||
| 630 | void QGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, void *data) | - | ||||||||||||||||||||||||||||||
| 631 | { | - | ||||||||||||||||||||||||||||||
| 632 | QGL2PEVectorPathCache *c = (QGL2PEVectorPathCache *) data; | - | ||||||||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||||||||
| 638 | - | |||||||||||||||||||||||||||||||
| 639 | (void)engine;; | - | ||||||||||||||||||||||||||||||
| 640 | free(c->vertices); | - | ||||||||||||||||||||||||||||||
| 641 | free(c->indices); | - | ||||||||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||||||||
| 643 | delete c; | - | ||||||||||||||||||||||||||||||
| 644 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||||||||
| 646 | - | |||||||||||||||||||||||||||||||
| 647 | void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) | - | ||||||||||||||||||||||||||||||
| 648 | { | - | ||||||||||||||||||||||||||||||
| 649 | transferMode(BrushDrawingMode); | - | ||||||||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||||||||
| 651 | if (snapToPixelGrid
| 0-42 | ||||||||||||||||||||||||||||||
| 652 | snapToPixelGrid = false; | - | ||||||||||||||||||||||||||||||
| 653 | matrixDirty = true; | - | ||||||||||||||||||||||||||||||
| 654 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||||||||
| 657 | if (matrixDirty
| 0-42 | ||||||||||||||||||||||||||||||
| 658 | updateMatrix(); never executed: updateMatrix(); | 0 | ||||||||||||||||||||||||||||||
| 659 | - | |||||||||||||||||||||||||||||||
| 660 | const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); | - | ||||||||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||||||||
| 663 | if (path.shape() == QVectorPath::RectangleHint
| 0-42 | ||||||||||||||||||||||||||||||
| 664 | QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y()); | - | ||||||||||||||||||||||||||||||
| 665 | prepareForDraw(currentBrush.isOpaque()); | - | ||||||||||||||||||||||||||||||
| 666 | composite(rect); | - | ||||||||||||||||||||||||||||||
| 667 | } executed 42 times by 1 test: else if (path.isConvex()end of blockExecuted by:
| 0-42 | ||||||||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||||||||
| 669 | if (path.isCacheable()
| 0 | ||||||||||||||||||||||||||||||
| 670 | QVectorPath::CacheEntry *data = path.lookupCacheData(q); | - | ||||||||||||||||||||||||||||||
| 671 | QGL2PEVectorPathCache *cache; | - | ||||||||||||||||||||||||||||||
| 672 | - | |||||||||||||||||||||||||||||||
| 673 | bool updateCache = false; | - | ||||||||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||||||||
| 675 | if (data
| 0 | ||||||||||||||||||||||||||||||
| 676 | cache = (QGL2PEVectorPathCache *) data->data; | - | ||||||||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||||||||
| 678 | if (path.isCurved()
| 0 | ||||||||||||||||||||||||||||||
| 679 | qreal scaleFactor = cache->iscale / inverseScale; | - | ||||||||||||||||||||||||||||||
| 680 | if (scaleFactor < 0.5
| 0 | ||||||||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||||||||
| 686 | free(cache->vertices); | - | ||||||||||||||||||||||||||||||
| 687 | ((!(cache->indices == 0)) ? qt_assert("cache->indices == 0",__FILE__,785) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||||||||
| 689 | updateCache = true; | - | ||||||||||||||||||||||||||||||
| 690 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 691 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 692 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 693 | cache = new QGL2PEVectorPathCache; | - | ||||||||||||||||||||||||||||||
| 694 | data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath); | - | ||||||||||||||||||||||||||||||
| 695 | updateCache = true; | - | ||||||||||||||||||||||||||||||
| 696 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||
| 698 | - | |||||||||||||||||||||||||||||||
| 699 | if (updateCache
| 0 | ||||||||||||||||||||||||||||||
| 700 | vertexCoordinateArray.clear(); | - | ||||||||||||||||||||||||||||||
| 701 | vertexCoordinateArray.addPath(path, inverseScale, false); | - | ||||||||||||||||||||||||||||||
| 702 | int vertexCount = vertexCoordinateArray.vertexCount(); | - | ||||||||||||||||||||||||||||||
| 703 | int floatSizeInBytes = vertexCount * 2 * sizeof(float); | - | ||||||||||||||||||||||||||||||
| 704 | cache->vertexCount = vertexCount; | - | ||||||||||||||||||||||||||||||
| 705 | cache->indexCount = 0; | - | ||||||||||||||||||||||||||||||
| 706 | cache->primitiveType = 0x0006; | - | ||||||||||||||||||||||||||||||
| 707 | cache->iscale = inverseScale; | - | ||||||||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||||||||
| 710 | - | |||||||||||||||||||||||||||||||
| 711 | - | |||||||||||||||||||||||||||||||
| 712 | - | |||||||||||||||||||||||||||||||
| 713 | - | |||||||||||||||||||||||||||||||
| 714 | cache->vertices = (float *) malloc(floatSizeInBytes); | - | ||||||||||||||||||||||||||||||
| 715 | memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes); | - | ||||||||||||||||||||||||||||||
| 716 | cache->indices = 0; | - | ||||||||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||||||||
| 718 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||||||||
| 720 | prepareForDraw(currentBrush.isOpaque()); | - | ||||||||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||||||||
| 722 | - | |||||||||||||||||||||||||||||||
| 723 | - | |||||||||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||||||||
| 725 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); | - | ||||||||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||||||||
| 727 | glDrawArrays(cache->primitiveType, 0, cache->vertexCount); | - | ||||||||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||||||||
| 729 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||||||||
| 732 | path.makeCacheable(); | - | ||||||||||||||||||||||||||||||
| 733 | vertexCoordinateArray.clear(); | - | ||||||||||||||||||||||||||||||
| 734 | vertexCoordinateArray.addPath(path, inverseScale, false); | - | ||||||||||||||||||||||||||||||
| 735 | prepareForDraw(currentBrush.isOpaque()); | - | ||||||||||||||||||||||||||||||
| 736 | drawVertexArrays(vertexCoordinateArray, 0x0006); | - | ||||||||||||||||||||||||||||||
| 737 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||||||||
| 739 | } else { | - | ||||||||||||||||||||||||||||||
| 740 | bool useCache = path.isCacheable(); | - | ||||||||||||||||||||||||||||||
| 741 | if (useCache
| 0 | ||||||||||||||||||||||||||||||
| 742 | QRectF bbox = path.controlPointRect(); | - | ||||||||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||||||||
| 744 | useCache &= (
| 0 | ||||||||||||||||||||||||||||||
| 745 | && (
| 0 | ||||||||||||||||||||||||||||||
| 746 | && (
| 0 | ||||||||||||||||||||||||||||||
| 747 | && (
| 0 | ||||||||||||||||||||||||||||||
| 748 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||||||||
| 750 | if (useCache
| 0 | ||||||||||||||||||||||||||||||
| 751 | QVectorPath::CacheEntry *data = path.lookupCacheData(q); | - | ||||||||||||||||||||||||||||||
| 752 | QGL2PEVectorPathCache *cache; | - | ||||||||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||||||||
| 754 | bool updateCache = false; | - | ||||||||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||||||||
| 756 | if (data
| 0 | ||||||||||||||||||||||||||||||
| 757 | cache = (QGL2PEVectorPathCache *) data->data; | - | ||||||||||||||||||||||||||||||
| 758 | - | |||||||||||||||||||||||||||||||
| 759 | if (path.isCurved()
| 0 | ||||||||||||||||||||||||||||||
| 760 | qreal scaleFactor = cache->iscale / inverseScale; | - | ||||||||||||||||||||||||||||||
| 761 | if (scaleFactor < 0.5
| 0 | ||||||||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||||||||
| 764 | - | |||||||||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||||||||
| 766 | free(cache->vertices); | - | ||||||||||||||||||||||||||||||
| 767 | free(cache->indices); | - | ||||||||||||||||||||||||||||||
| 768 | - | |||||||||||||||||||||||||||||||
| 769 | updateCache = true; | - | ||||||||||||||||||||||||||||||
| 770 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 771 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 772 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 773 | cache = new QGL2PEVectorPathCache; | - | ||||||||||||||||||||||||||||||
| 774 | data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath); | - | ||||||||||||||||||||||||||||||
| 775 | updateCache = true; | - | ||||||||||||||||||||||||||||||
| 776 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 777 | - | |||||||||||||||||||||||||||||||
| 778 | - | |||||||||||||||||||||||||||||||
| 779 | if (updateCache
| 0 | ||||||||||||||||||||||||||||||
| 780 | QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); | - | ||||||||||||||||||||||||||||||
| 781 | cache->vertexCount = polys.vertices.size() / 2; | - | ||||||||||||||||||||||||||||||
| 782 | cache->indexCount = polys.indices.size(); | - | ||||||||||||||||||||||||||||||
| 783 | cache->primitiveType = 0x0004; | - | ||||||||||||||||||||||||||||||
| 784 | cache->iscale = inverseScale; | - | ||||||||||||||||||||||||||||||
| 785 | cache->indexType = polys.indices.type(); | - | ||||||||||||||||||||||||||||||
| 786 | cache->vertices = (float *) malloc(sizeof(float) * polys.vertices.size()); | - | ||||||||||||||||||||||||||||||
| 787 | if (polys.indices.type() == QVertexIndexVector::UnsignedInt
| 0 | ||||||||||||||||||||||||||||||
| 788 | cache->indices = (quint32 *) malloc(sizeof(quint32) * polys.indices.size()); | - | ||||||||||||||||||||||||||||||
| 789 | memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size()); | - | ||||||||||||||||||||||||||||||
| 790 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 791 | cache->indices = (quint16 *) malloc(sizeof(quint16) * polys.indices.size()); | - | ||||||||||||||||||||||||||||||
| 792 | memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size()); | - | ||||||||||||||||||||||||||||||
| 793 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 794 | for (int i = 0; i < polys.vertices.size()
| 0 | ||||||||||||||||||||||||||||||
| 795 | cache->vertices[i] = float(inverseScale * polys.vertices.at(i)); never executed: cache->vertices[i] = float(inverseScale * polys.vertices.at(i)); | 0 | ||||||||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||||||||
| 797 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 798 | - | |||||||||||||||||||||||||||||||
| 799 | prepareForDraw(currentBrush.isOpaque()); | - | ||||||||||||||||||||||||||||||
| 800 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); | - | ||||||||||||||||||||||||||||||
| 801 | if (cache->indexType == QVertexIndexVector::UnsignedInt
| 0 | ||||||||||||||||||||||||||||||
| 802 | glDrawElements(cache->primitiveType, cache->indexCount, 0x1405, (qint32 *)cache->indices); never executed: glDrawElements(cache->primitiveType, cache->indexCount, 0x1405, (qint32 *)cache->indices); | 0 | ||||||||||||||||||||||||||||||
| 803 | else | - | ||||||||||||||||||||||||||||||
| 804 | glDrawElements(cache->primitiveType, cache->indexCount, 0x1403, (qint16 *)cache->indices); never executed: glDrawElements(cache->primitiveType, cache->indexCount, 0x1403, (qint16 *)cache->indices); | 0 | ||||||||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||||||||
| 807 | } else { | - | ||||||||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||||||||
| 809 | - | |||||||||||||||||||||||||||||||
| 810 | path.makeCacheable(); | - | ||||||||||||||||||||||||||||||
| 811 | - | |||||||||||||||||||||||||||||||
| 812 | if (!device->format().stencil()
| 0 | ||||||||||||||||||||||||||||||
| 813 | - | |||||||||||||||||||||||||||||||
| 814 | - | |||||||||||||||||||||||||||||||
| 815 | QRectF bbox = path.controlPointRect(); | - | ||||||||||||||||||||||||||||||
| 816 | - | |||||||||||||||||||||||||||||||
| 817 | bool withinLimits = (
| 0 | ||||||||||||||||||||||||||||||
| 818 | && (
| 0 | ||||||||||||||||||||||||||||||
| 819 | && (
| 0 | ||||||||||||||||||||||||||||||
| 820 | && (
| 0 | ||||||||||||||||||||||||||||||
| 821 | if (withinLimits
| 0 | ||||||||||||||||||||||||||||||
| 822 | QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); | - | ||||||||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||||||||
| 824 | QVarLengthArray<float> vertices(polys.vertices.size()); | - | ||||||||||||||||||||||||||||||
| 825 | for (int i = 0; i < polys.vertices.size()
| 0 | ||||||||||||||||||||||||||||||
| 826 | vertices[i] = float(inverseScale * polys.vertices.at(i)); never executed: vertices[i] = float(inverseScale * polys.vertices.at(i)); | 0 | ||||||||||||||||||||||||||||||
| 827 | - | |||||||||||||||||||||||||||||||
| 828 | prepareForDraw(currentBrush.isOpaque()); | - | ||||||||||||||||||||||||||||||
| 829 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData()); | - | ||||||||||||||||||||||||||||||
| 830 | if (polys.indices.type() == QVertexIndexVector::UnsignedInt
| 0 | ||||||||||||||||||||||||||||||
| 831 | glDrawElements(0x0004, polys.indices.size(), 0x1405, polys.indices.data()); never executed: glDrawElements(0x0004, polys.indices.size(), 0x1405, polys.indices.data()); | 0 | ||||||||||||||||||||||||||||||
| 832 | else | - | ||||||||||||||||||||||||||||||
| 833 | glDrawElements(0x0004, polys.indices.size(), 0x1403, polys.indices.data()); never executed: glDrawElements(0x0004, polys.indices.size(), 0x1403, polys.indices.data()); | 0 | ||||||||||||||||||||||||||||||
| 834 | } else { | - | ||||||||||||||||||||||||||||||
| 835 | - | |||||||||||||||||||||||||||||||
| 836 | QMessageLogger(__FILE__, 961, __PRETTY_FUNCTION__).warning("Painter path exceeds +/-32767 pixels."); | - | ||||||||||||||||||||||||||||||
| 837 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 838 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 839 | } | - | ||||||||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||||||||
| 841 | - | |||||||||||||||||||||||||||||||
| 842 | vertexCoordinateArray.clear(); | - | ||||||||||||||||||||||||||||||
| 843 | vertexCoordinateArray.addPath(path, inverseScale, false); | - | ||||||||||||||||||||||||||||||
| 844 | - | |||||||||||||||||||||||||||||||
| 845 | fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); | - | ||||||||||||||||||||||||||||||
| 846 | - | |||||||||||||||||||||||||||||||
| 847 | glStencilMask(0xff); | - | ||||||||||||||||||||||||||||||
| 848 | glStencilOp(0x1E00, 0x1E01, 0x1E01); | - | ||||||||||||||||||||||||||||||
| 849 | - | |||||||||||||||||||||||||||||||
| 850 | if (q->state()->clipTestEnabled
| 0 | ||||||||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||||||||
| 852 | glStencilFunc(0x0205, q->state()->currentClip, GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 853 | } never executed: else if (path.hasWindingFill()end of block
| 0 | ||||||||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||||||||
| 855 | glStencilFunc(0x0205, 0, 0xff); | - | ||||||||||||||||||||||||||||||
| 856 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 857 | - | |||||||||||||||||||||||||||||||
| 858 | glStencilFunc(0x0205, 0, GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 859 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 860 | prepareForDraw(currentBrush.isOpaque()); | - | ||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||
| 862 | - | |||||||||||||||||||||||||||||||
| 863 | composite(vertexCoordinateArray.boundingRect()); | - | ||||||||||||||||||||||||||||||
| 864 | glStencilMask(0); | - | ||||||||||||||||||||||||||||||
| 865 | updateClipScissorTest(); | - | ||||||||||||||||||||||||||||||
| 866 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 867 | } | - | ||||||||||||||||||||||||||||||
| 868 | } | - | ||||||||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||||||||
| 871 | void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, | - | ||||||||||||||||||||||||||||||
| 872 | int count, | - | ||||||||||||||||||||||||||||||
| 873 | int *stops, | - | ||||||||||||||||||||||||||||||
| 874 | int stopCount, | - | ||||||||||||||||||||||||||||||
| 875 | const QGLRect &bounds, | - | ||||||||||||||||||||||||||||||
| 876 | StencilFillMode mode) | - | ||||||||||||||||||||||||||||||
| 877 | { | - | ||||||||||||||||||||||||||||||
| 878 | ((!(count || stops)) ? qt_assert("count || stops",__FILE__,1003) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||||||||
| 881 | glStencilMask(0xff); | - | ||||||||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||||||||
| 883 | if (dirtyStencilRegion.intersects(currentScissorBounds)
| 0-3 | ||||||||||||||||||||||||||||||
| 884 | QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); | - | ||||||||||||||||||||||||||||||
| 885 | glClearStencil(0); | - | ||||||||||||||||||||||||||||||
| 886 | for (int i = 0; i < clearRegion.size()
| 0 | ||||||||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||||||||
| 888 | setScissor(clearRegion.at(i)); | - | ||||||||||||||||||||||||||||||
| 889 | - | |||||||||||||||||||||||||||||||
| 890 | glClear(0x00000400); | - | ||||||||||||||||||||||||||||||
| 891 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||||||||
| 893 | dirtyStencilRegion -= currentScissorBounds; | - | ||||||||||||||||||||||||||||||
| 894 | - | |||||||||||||||||||||||||||||||
| 895 | - | |||||||||||||||||||||||||||||||
| 896 | updateClipScissorTest(); | - | ||||||||||||||||||||||||||||||
| 897 | - | |||||||||||||||||||||||||||||||
| 898 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 899 | - | |||||||||||||||||||||||||||||||
| 900 | glColorMask(0, 0, 0, 0); | - | ||||||||||||||||||||||||||||||
| 901 | useSimpleShader(); | - | ||||||||||||||||||||||||||||||
| 902 | glEnable(0x0B90); | - | ||||||||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||||||||
| 904 | if (mode == WindingFillMode
| 0-3 | ||||||||||||||||||||||||||||||
| 905 | ((!(stops && !count)) ? qt_assert("stops && !count",__FILE__,1030) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 906 | if (q->state()->clipTestEnabled
| 0 | ||||||||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||||||||
| 908 | glStencilFunc(0x0203, GLuint(0x80) | q->state()->currentClip, ~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 909 | glStencilOp(0x1E00, 0x1E01, 0x1E01); | - | ||||||||||||||||||||||||||||||
| 910 | composite(bounds); | - | ||||||||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||||||||
| 912 | glStencilFunc(0x0202, GLuint(0x80), GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 913 | } never executed: else if (!stencilCleanend of block
| 0 | ||||||||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||||||||
| 915 | glStencilFunc(0x0207, 0, 0xff); | - | ||||||||||||||||||||||||||||||
| 916 | glStencilOp(0, 0, 0); | - | ||||||||||||||||||||||||||||||
| 917 | composite(bounds); | - | ||||||||||||||||||||||||||||||
| 918 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 919 | - | |||||||||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||||||||
| 921 | glStencilOpSeparate(0x0404, 0x1E00, 0x8507, 0x8507); | - | ||||||||||||||||||||||||||||||
| 922 | - | |||||||||||||||||||||||||||||||
| 923 | glStencilOpSeparate(0x0405, 0x1E00, 0x8508, 0x8508); | - | ||||||||||||||||||||||||||||||
| 924 | glStencilMask(~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 925 | drawVertexArrays(data, stops, stopCount, 0x0006); | - | ||||||||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||||||||
| 927 | if (q->state()->clipTestEnabled
| 0 | ||||||||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||||||||
| 929 | glStencilFunc(0x0202, q->state()->currentClip, ~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 930 | glStencilOp(0x1E00, 0x1E01, 0x1E01); | - | ||||||||||||||||||||||||||||||
| 931 | glStencilMask(GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 932 | composite(bounds); | - | ||||||||||||||||||||||||||||||
| 933 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 934 | } never executed: else if (mode == OddEvenFillModeend of block
| 0-3 | ||||||||||||||||||||||||||||||
| 935 | glStencilMask(GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 936 | glStencilOp(0x1E00, 0x1E00, 0x150A); | - | ||||||||||||||||||||||||||||||
| 937 | drawVertexArrays(data, stops, stopCount, 0x0006); | - | ||||||||||||||||||||||||||||||
| 938 | - | |||||||||||||||||||||||||||||||
| 939 | } executed 3 times by 1 test: else {end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 940 | ((!(count && !stops)) ? qt_assert("count && !stops",__FILE__,1065) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 941 | glStencilMask(GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 942 | - | |||||||||||||||||||||||||||||||
| 943 | - | |||||||||||||||||||||||||||||||
| 944 | - | |||||||||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||||||||
| 946 | - | |||||||||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||||||||
| 948 | glStencilOp(0x1E00, 0x1E00, 0x1E01); | - | ||||||||||||||||||||||||||||||
| 949 | if (q->state()->clipTestEnabled
| 0 | ||||||||||||||||||||||||||||||
| 950 | glStencilFunc(0x0203, q->state()->currentClip | GLuint(0x80), | - | ||||||||||||||||||||||||||||||
| 951 | ~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 952 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 953 | glStencilFunc(0x0207, GLuint(0x80), 0xff); | - | ||||||||||||||||||||||||||||||
| 954 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 955 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); | - | ||||||||||||||||||||||||||||||
| 956 | glDrawArrays(0x0005, 0, count); | - | ||||||||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||||||||
| 958 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||||||||
| 960 | - | |||||||||||||||||||||||||||||||
| 961 | glColorMask(1, 1, 1, 1); | - | ||||||||||||||||||||||||||||||
| 962 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 963 | - | |||||||||||||||||||||||||||||||
| 964 | - | |||||||||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||||||||
| 968 | - | |||||||||||||||||||||||||||||||
| 969 | void QGL2PaintEngineExPrivate::resetClipIfNeeded() | - | ||||||||||||||||||||||||||||||
| 970 | { | - | ||||||||||||||||||||||||||||||
| 971 | if (maxClip != (GLuint(0x80) - 1)
| 0 | ||||||||||||||||||||||||||||||
| 972 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 973 | - | |||||||||||||||||||||||||||||||
| 974 | QGL2PaintEngineEx * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 975 | - | |||||||||||||||||||||||||||||||
| 976 | useSimpleShader(); | - | ||||||||||||||||||||||||||||||
| 977 | glEnable(0x0B90); | - | ||||||||||||||||||||||||||||||
| 978 | glColorMask(0, 0, 0, 0); | - | ||||||||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||||||||
| 980 | QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height)); | - | ||||||||||||||||||||||||||||||
| 981 | QGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom()); | - | ||||||||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||||||||
| 983 | - | |||||||||||||||||||||||||||||||
| 984 | glStencilFunc(0x0203, q->state()->currentClip, 0xff); | - | ||||||||||||||||||||||||||||||
| 985 | glStencilOp(0x1E00, 0x150A, 0x150A); | - | ||||||||||||||||||||||||||||||
| 986 | glStencilMask(GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 987 | composite(rect); | - | ||||||||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||||||||
| 990 | glStencilFunc(0x0205, 0x01, GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 991 | glStencilOp(0, 0x1E01, 0x1E01); | - | ||||||||||||||||||||||||||||||
| 992 | glStencilMask(0xff); | - | ||||||||||||||||||||||||||||||
| 993 | composite(rect); | - | ||||||||||||||||||||||||||||||
| 994 | - | |||||||||||||||||||||||||||||||
| 995 | q->state()->currentClip = 1; | - | ||||||||||||||||||||||||||||||
| 996 | q->state()->canRestoreClip = false; | - | ||||||||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||||||||
| 998 | maxClip = 1; | - | ||||||||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||||||||
| 1000 | glStencilMask(0x0); | - | ||||||||||||||||||||||||||||||
| 1001 | glColorMask(1, 1, 1, 1); | - | ||||||||||||||||||||||||||||||
| 1002 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1003 | - | |||||||||||||||||||||||||||||||
| 1004 | bool QGL2PaintEngineExPrivate::prepareForCachedGlyphDraw(const QFontEngineGlyphCache &cache) | - | ||||||||||||||||||||||||||||||
| 1005 | { | - | ||||||||||||||||||||||||||||||
| 1006 | QGL2PaintEngineEx * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1007 | - | |||||||||||||||||||||||||||||||
| 1008 | ((!(cache.transform().type() <= QTransform::TxScale)) ? qt_assert("cache.transform().type() <= QTransform::TxScale",__FILE__,1133) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1009 | - | |||||||||||||||||||||||||||||||
| 1010 | QTransform &transform = q->state()->matrix; | - | ||||||||||||||||||||||||||||||
| 1011 | transform.scale(1.0 / cache.transform().m11(), 1.0 / cache.transform().m22()); | - | ||||||||||||||||||||||||||||||
| 1012 | bool ret = prepareForDraw(false); | - | ||||||||||||||||||||||||||||||
| 1013 | transform.scale(cache.transform().m11(), cache.transform().m22()); | - | ||||||||||||||||||||||||||||||
| 1014 | - | |||||||||||||||||||||||||||||||
| 1015 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||
| 1016 | } | - | ||||||||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||||||||
| 1018 | bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) | - | ||||||||||||||||||||||||||||||
| 1019 | { | - | ||||||||||||||||||||||||||||||
| 1020 | if (brushTextureDirty
| 0-39 | ||||||||||||||||||||||||||||||
| 1021 | updateBrushTexture(); executed 3 times by 1 test: updateBrushTexture();Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 1022 | - | |||||||||||||||||||||||||||||||
| 1023 | if (compositionModeDirty
| 3-39 | ||||||||||||||||||||||||||||||
| 1024 | updateCompositionMode(); executed 3 times by 1 test: updateCompositionMode();Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 1025 | - | |||||||||||||||||||||||||||||||
| 1026 | if (matrixDirty
| 0-42 | ||||||||||||||||||||||||||||||
| 1027 | updateMatrix(); never executed: updateMatrix(); | 0 | ||||||||||||||||||||||||||||||
| 1028 | - | |||||||||||||||||||||||||||||||
| 1029 | const bool stateHasOpacity = q->state()->opacity < 0.99f; | - | ||||||||||||||||||||||||||||||
| 1030 | if (q->state()->composition_mode == QPainter::CompositionMode_Source
| 0-42 | ||||||||||||||||||||||||||||||
| 1031 | || (q->state()->composition_mode == QPainter::CompositionMode_SourceOver
| 0-42 | ||||||||||||||||||||||||||||||
| 1032 | && srcPixelsAreOpaque
| 0-42 | ||||||||||||||||||||||||||||||
| 1033 | { | - | ||||||||||||||||||||||||||||||
| 1034 | glDisable(0x0BE2); | - | ||||||||||||||||||||||||||||||
| 1035 | } executed 42 times by 1 test: else {end of blockExecuted by:
| 42 | ||||||||||||||||||||||||||||||
| 1036 | glEnable(0x0BE2); | - | ||||||||||||||||||||||||||||||
| 1037 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1038 | - | |||||||||||||||||||||||||||||||
| 1039 | QGLEngineShaderManager::OpacityMode opacityMode; | - | ||||||||||||||||||||||||||||||
| 1040 | if (mode == ImageArrayDrawingMode
| 0-42 | ||||||||||||||||||||||||||||||
| 1041 | opacityMode = QGLEngineShaderManager::AttributeOpacity; | - | ||||||||||||||||||||||||||||||
| 1042 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1043 | opacityMode = stateHasOpacity
| 0-42 | ||||||||||||||||||||||||||||||
| 1044 | : QGLEngineShaderManager::NoOpacity; | - | ||||||||||||||||||||||||||||||
| 1045 | if (stateHasOpacity
| 0-42 | ||||||||||||||||||||||||||||||
| 1046 | - | |||||||||||||||||||||||||||||||
| 1047 | bool brushIsPattern = (
| 0 | ||||||||||||||||||||||||||||||
| 1048 | (
| 0 | ||||||||||||||||||||||||||||||
| 1049 | - | |||||||||||||||||||||||||||||||
| 1050 | if ((
| 0 | ||||||||||||||||||||||||||||||
| 1051 | opacityMode = QGLEngineShaderManager::NoOpacity; never executed: opacityMode = QGLEngineShaderManager::NoOpacity; | 0 | ||||||||||||||||||||||||||||||
| 1052 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1053 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||||||||
| 1054 | shaderManager->setOpacityMode(opacityMode); | - | ||||||||||||||||||||||||||||||
| 1055 | - | |||||||||||||||||||||||||||||||
| 1056 | bool changed = shaderManager->useCorrectShaderProg(); | - | ||||||||||||||||||||||||||||||
| 1057 | - | |||||||||||||||||||||||||||||||
| 1058 | if (changed
| 3-39 | ||||||||||||||||||||||||||||||
| 1059 | - | |||||||||||||||||||||||||||||||
| 1060 | brushUniformsDirty = true; | - | ||||||||||||||||||||||||||||||
| 1061 | opacityUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1062 | matrixUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1063 | translateZUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1064 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||||||||
| 1066 | if (brushUniformsDirty
| 0-39 | ||||||||||||||||||||||||||||||
| 1067 | updateBrushUniforms(); executed 3 times by 1 test: updateBrushUniforms();Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 1068 | - | |||||||||||||||||||||||||||||||
| 1069 | if (opacityMode == QGLEngineShaderManager::UniformOpacity
| 0-42 | ||||||||||||||||||||||||||||||
| 1070 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity); | - | ||||||||||||||||||||||||||||||
| 1071 | opacityUniformDirty = false; | - | ||||||||||||||||||||||||||||||
| 1072 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||||||||
| 1074 | if (matrixUniformDirty
| 0-42 | ||||||||||||||||||||||||||||||
| 1075 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Matrix), | - | ||||||||||||||||||||||||||||||
| 1076 | pmvMatrix); | - | ||||||||||||||||||||||||||||||
| 1077 | matrixUniformDirty = false; | - | ||||||||||||||||||||||||||||||
| 1078 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||||||||
| 1080 | if (translateZUniformDirty
| 0-42 | ||||||||||||||||||||||||||||||
| 1081 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::TranslateZ), | - | ||||||||||||||||||||||||||||||
| 1082 | translateZ); | - | ||||||||||||||||||||||||||||||
| 1083 | translateZUniformDirty = false; | - | ||||||||||||||||||||||||||||||
| 1084 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1085 | - | |||||||||||||||||||||||||||||||
| 1086 | return executed 42 times by 1 test: changed;return changed;Executed by:
executed 42 times by 1 test: return changed;Executed by:
| 42 | ||||||||||||||||||||||||||||||
| 1087 | } | - | ||||||||||||||||||||||||||||||
| 1088 | - | |||||||||||||||||||||||||||||||
| 1089 | void QGL2PaintEngineExPrivate::composite(const QGLRect& boundingRect) | - | ||||||||||||||||||||||||||||||
| 1090 | { | - | ||||||||||||||||||||||||||||||
| 1091 | setCoords(staticVertexCoordinateArray, boundingRect); | - | ||||||||||||||||||||||||||||||
| 1092 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); | - | ||||||||||||||||||||||||||||||
| 1093 | glDrawArrays(0x0006, 0, 4); | - | ||||||||||||||||||||||||||||||
| 1094 | } executed 45 times by 1 test: end of blockExecuted by:
| 45 | ||||||||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||||||||
| 1096 | - | |||||||||||||||||||||||||||||||
| 1097 | void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, int stopCount, | - | ||||||||||||||||||||||||||||||
| 1098 | GLenum primitive) | - | ||||||||||||||||||||||||||||||
| 1099 | { | - | ||||||||||||||||||||||||||||||
| 1100 | - | |||||||||||||||||||||||||||||||
| 1101 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); | - | ||||||||||||||||||||||||||||||
| 1102 | - | |||||||||||||||||||||||||||||||
| 1103 | int previousStop = 0; | - | ||||||||||||||||||||||||||||||
| 1104 | for (int i=0; i<stopCount
| 3-42 | ||||||||||||||||||||||||||||||
| 1105 | int stop = stops[i]; | - | ||||||||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||||||||
| 1107 | - | |||||||||||||||||||||||||||||||
| 1108 | - | |||||||||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||||||||
| 1110 | - | |||||||||||||||||||||||||||||||
| 1111 | glDrawArrays(primitive, previousStop, stop - previousStop); | - | ||||||||||||||||||||||||||||||
| 1112 | previousStop = stop; | - | ||||||||||||||||||||||||||||||
| 1113 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||||||||
| 1114 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 1115 | - | |||||||||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||||||||
| 1117 | - | |||||||||||||||||||||||||||||||
| 1118 | QGL2PaintEngineEx::QGL2PaintEngineEx() | - | ||||||||||||||||||||||||||||||
| 1119 | : QPaintEngineEx(*(new QGL2PaintEngineExPrivate(this))) | - | ||||||||||||||||||||||||||||||
| 1120 | { | - | ||||||||||||||||||||||||||||||
| 1121 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||||||||
| 1122 | - | |||||||||||||||||||||||||||||||
| 1123 | QGL2PaintEngineEx::~QGL2PaintEngineEx() | - | ||||||||||||||||||||||||||||||
| 1124 | { | - | ||||||||||||||||||||||||||||||
| 1125 | } | - | ||||||||||||||||||||||||||||||
| 1126 | - | |||||||||||||||||||||||||||||||
| 1127 | void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 1128 | { | - | ||||||||||||||||||||||||||||||
| 1129 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||||||||
| 1131 | if (qbrush_style(brush) == Qt::NoBrush
| 0-42 | ||||||||||||||||||||||||||||||
| 1132 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1133 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 1134 | d->setBrush(brush); | - | ||||||||||||||||||||||||||||||
| 1135 | d->fill(path); | - | ||||||||||||||||||||||||||||||
| 1136 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||||||||
| 1137 | - | |||||||||||||||||||||||||||||||
| 1138 | __attribute__((visibility("default"))) bool qt_scaleForTransform(const QTransform &transform, qreal *scale); | - | ||||||||||||||||||||||||||||||
| 1139 | - | |||||||||||||||||||||||||||||||
| 1140 | - | |||||||||||||||||||||||||||||||
| 1141 | void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) | - | ||||||||||||||||||||||||||||||
| 1142 | { | - | ||||||||||||||||||||||||||||||
| 1143 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1144 | - | |||||||||||||||||||||||||||||||
| 1145 | const QBrush &penBrush = qpen_brush(pen); | - | ||||||||||||||||||||||||||||||
| 1146 | if (qpen_style(pen) == Qt::NoPen
| 0 | ||||||||||||||||||||||||||||||
| 1147 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||||||||
| 1149 | QGL2PaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1150 | if (qt_pen_is_cosmetic(pen, s->renderHints)
| 0 | ||||||||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||||||||
| 1152 | QPaintEngineEx::stroke(path, pen); | - | ||||||||||||||||||||||||||||||
| 1153 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1154 | } | - | ||||||||||||||||||||||||||||||
| 1155 | - | |||||||||||||||||||||||||||||||
| 1156 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 1157 | d->setBrush(penBrush); | - | ||||||||||||||||||||||||||||||
| 1158 | d->stroke(path, pen); | - | ||||||||||||||||||||||||||||||
| 1159 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1160 | - | |||||||||||||||||||||||||||||||
| 1161 | void QGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &pen) | - | ||||||||||||||||||||||||||||||
| 1162 | { | - | ||||||||||||||||||||||||||||||
| 1163 | const QGL2PaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 1164 | if (snapToPixelGrid
| 0 | ||||||||||||||||||||||||||||||
| 1165 | snapToPixelGrid = false; | - | ||||||||||||||||||||||||||||||
| 1166 | matrixDirty = true; | - | ||||||||||||||||||||||||||||||
| 1167 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1168 | - | |||||||||||||||||||||||||||||||
| 1169 | const Qt::PenStyle penStyle = qpen_style(pen); | - | ||||||||||||||||||||||||||||||
| 1170 | const QBrush &penBrush = qpen_brush(pen); | - | ||||||||||||||||||||||||||||||
| 1171 | const bool opaque = penBrush.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 1172 | - | |||||||||||||||||||||||||||||||
| 1173 | transferMode(BrushDrawingMode); | - | ||||||||||||||||||||||||||||||
| 1174 | - | |||||||||||||||||||||||||||||||
| 1175 | - | |||||||||||||||||||||||||||||||
| 1176 | - | |||||||||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||||||||
| 1178 | updateMatrix(); | - | ||||||||||||||||||||||||||||||
| 1179 | - | |||||||||||||||||||||||||||||||
| 1180 | QRectF clip = q->state()->matrix.inverted().mapRect(q->state()->clipEnabled | - | ||||||||||||||||||||||||||||||
| 1181 | ? q->state()->rectangleClip | - | ||||||||||||||||||||||||||||||
| 1182 | : QRectF(0, 0, width, height)); | - | ||||||||||||||||||||||||||||||
| 1183 | - | |||||||||||||||||||||||||||||||
| 1184 | if (penStyle == Qt::SolidLine
| 0 | ||||||||||||||||||||||||||||||
| 1185 | stroker.process(path, pen, clip, s->renderHints); | - | ||||||||||||||||||||||||||||||
| 1186 | - | |||||||||||||||||||||||||||||||
| 1187 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1188 | dasher.process(path, pen, clip, s->renderHints); | - | ||||||||||||||||||||||||||||||
| 1189 | - | |||||||||||||||||||||||||||||||
| 1190 | QVectorPath dashStroke(dasher.points(), | - | ||||||||||||||||||||||||||||||
| 1191 | dasher.elementCount(), | - | ||||||||||||||||||||||||||||||
| 1192 | dasher.elementTypes()); | - | ||||||||||||||||||||||||||||||
| 1193 | stroker.process(dashStroke, pen, clip, s->renderHints); | - | ||||||||||||||||||||||||||||||
| 1194 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1195 | - | |||||||||||||||||||||||||||||||
| 1196 | if (!stroker.vertexCount()
| 0 | ||||||||||||||||||||||||||||||
| 1197 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1198 | - | |||||||||||||||||||||||||||||||
| 1199 | if (opaque
| 0 | ||||||||||||||||||||||||||||||
| 1200 | prepareForDraw(opaque); | - | ||||||||||||||||||||||||||||||
| 1201 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices()); | - | ||||||||||||||||||||||||||||||
| 1202 | glDrawArrays(0x0005, 0, stroker.vertexCount() / 2); | - | ||||||||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||||||||
| 1205 | - | |||||||||||||||||||||||||||||||
| 1206 | - | |||||||||||||||||||||||||||||||
| 1207 | - | |||||||||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||||||||
| 1209 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1210 | qreal width = qpen_widthf(pen) / 2; | - | ||||||||||||||||||||||||||||||
| 1211 | if (width == 0
| 0 | ||||||||||||||||||||||||||||||
| 1212 | width = 0.5; never executed: width = 0.5; | 0 | ||||||||||||||||||||||||||||||
| 1213 | qreal extra = pen.joinStyle() == Qt::MiterJoin
| 0 | ||||||||||||||||||||||||||||||
| 1214 | ? qMax(pen.miterLimit() * width, width) | - | ||||||||||||||||||||||||||||||
| 1215 | : width; | - | ||||||||||||||||||||||||||||||
| 1216 | - | |||||||||||||||||||||||||||||||
| 1217 | if (qt_pen_is_cosmetic(pen, s->renderHints)
| 0 | ||||||||||||||||||||||||||||||
| 1218 | extra = extra * inverseScale; never executed: extra = extra * inverseScale; | 0 | ||||||||||||||||||||||||||||||
| 1219 | - | |||||||||||||||||||||||||||||||
| 1220 | QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra); | - | ||||||||||||||||||||||||||||||
| 1221 | - | |||||||||||||||||||||||||||||||
| 1222 | fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2, | - | ||||||||||||||||||||||||||||||
| 1223 | 0, 0, bounds, QGL2PaintEngineExPrivate::TriStripStrokeFillMode); | - | ||||||||||||||||||||||||||||||
| 1224 | - | |||||||||||||||||||||||||||||||
| 1225 | glStencilOp(0x1E00, 0x1E01, 0x1E01); | - | ||||||||||||||||||||||||||||||
| 1226 | - | |||||||||||||||||||||||||||||||
| 1227 | - | |||||||||||||||||||||||||||||||
| 1228 | glStencilFunc(0x0205, 0, GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 1229 | prepareForDraw(false); | - | ||||||||||||||||||||||||||||||
| 1230 | - | |||||||||||||||||||||||||||||||
| 1231 | - | |||||||||||||||||||||||||||||||
| 1232 | composite(bounds); | - | ||||||||||||||||||||||||||||||
| 1233 | - | |||||||||||||||||||||||||||||||
| 1234 | glStencilMask(0); | - | ||||||||||||||||||||||||||||||
| 1235 | - | |||||||||||||||||||||||||||||||
| 1236 | updateClipScissorTest(); | - | ||||||||||||||||||||||||||||||
| 1237 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1238 | } | - | ||||||||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||||||||
| 1240 | void QGL2PaintEngineEx::penChanged() { } | - | ||||||||||||||||||||||||||||||
| 1241 | void QGL2PaintEngineEx::brushChanged() { } | - | ||||||||||||||||||||||||||||||
| 1242 | void QGL2PaintEngineEx::brushOriginChanged() { } | - | ||||||||||||||||||||||||||||||
| 1243 | - | |||||||||||||||||||||||||||||||
| 1244 | void QGL2PaintEngineEx::opacityChanged() | - | ||||||||||||||||||||||||||||||
| 1245 | { | - | ||||||||||||||||||||||||||||||
| 1246 | - | |||||||||||||||||||||||||||||||
| 1247 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1248 | state()->opacityChanged = true; | - | ||||||||||||||||||||||||||||||
| 1249 | - | |||||||||||||||||||||||||||||||
| 1250 | ((!(d->shaderManager)) ? qt_assert("d->shaderManager",__FILE__,1375) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1251 | d->brushUniformsDirty = true; | - | ||||||||||||||||||||||||||||||
| 1252 | d->opacityUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1253 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1254 | - | |||||||||||||||||||||||||||||||
| 1255 | void QGL2PaintEngineEx::compositionModeChanged() | - | ||||||||||||||||||||||||||||||
| 1256 | { | - | ||||||||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||||||||
| 1258 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1259 | state()->compositionModeChanged = true; | - | ||||||||||||||||||||||||||||||
| 1260 | d->compositionModeDirty = true; | - | ||||||||||||||||||||||||||||||
| 1261 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||||||||
| 1263 | void QGL2PaintEngineEx::renderHintsChanged() | - | ||||||||||||||||||||||||||||||
| 1264 | { | - | ||||||||||||||||||||||||||||||
| 1265 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1266 | state()->renderHintsChanged = true; | - | ||||||||||||||||||||||||||||||
| 1267 | - | |||||||||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||||||||
| 1269 | if (!d->ctx->contextHandle()->isOpenGLES()
| 0-3 | ||||||||||||||||||||||||||||||
| 1270 | if ((state()->renderHints & QPainter::Antialiasing) | - | ||||||||||||||||||||||||||||||
| 1271 | || (state()->renderHints & QPainter::HighQualityAntialiasing)) | - | ||||||||||||||||||||||||||||||
| 1272 | d->glEnable(0x809D); never executed: d->glEnable(0x809D); | 0 | ||||||||||||||||||||||||||||||
| 1273 | else | - | ||||||||||||||||||||||||||||||
| 1274 | d->glDisable(0x809D); executed 3 times by 1 test: d->glDisable(0x809D);Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 1275 | } | - | ||||||||||||||||||||||||||||||
| 1276 | - | |||||||||||||||||||||||||||||||
| 1277 | - | |||||||||||||||||||||||||||||||
| 1278 | d->lastTextureUsed = GLuint(-1); | - | ||||||||||||||||||||||||||||||
| 1279 | d->brushTextureDirty = true; | - | ||||||||||||||||||||||||||||||
| 1280 | - | |||||||||||||||||||||||||||||||
| 1281 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 1282 | - | |||||||||||||||||||||||||||||||
| 1283 | void QGL2PaintEngineEx::transformChanged() | - | ||||||||||||||||||||||||||||||
| 1284 | { | - | ||||||||||||||||||||||||||||||
| 1285 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1286 | d->matrixDirty = true; | - | ||||||||||||||||||||||||||||||
| 1287 | state()->matrixChanged = true; | - | ||||||||||||||||||||||||||||||
| 1288 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1289 | - | |||||||||||||||||||||||||||||||
| 1290 | - | |||||||||||||||||||||||||||||||
| 1291 | static const QRectF scaleRect(const QRectF &r, qreal sx, qreal sy) | - | ||||||||||||||||||||||||||||||
| 1292 | { | - | ||||||||||||||||||||||||||||||
| 1293 | return never executed: QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy);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 | ||||||||||||||||||||||||||||||
| 1294 | } | - | ||||||||||||||||||||||||||||||
| 1295 | - | |||||||||||||||||||||||||||||||
| 1296 | void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, const QRectF & src) | - | ||||||||||||||||||||||||||||||
| 1297 | { | - | ||||||||||||||||||||||||||||||
| 1298 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1299 | QGLContext *ctx = d->ctx; | - | ||||||||||||||||||||||||||||||
| 1300 | - | |||||||||||||||||||||||||||||||
| 1301 | int max_texture_size = ctx->d_func()->maxTextureSize(); | - | ||||||||||||||||||||||||||||||
| 1302 | if (pixmap.width() > max_texture_size
| 0 | ||||||||||||||||||||||||||||||
| 1303 | QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); | - | ||||||||||||||||||||||||||||||
| 1304 | - | |||||||||||||||||||||||||||||||
| 1305 | const qreal sx = scaled.width() / qreal(pixmap.width()); | - | ||||||||||||||||||||||||||||||
| 1306 | const qreal sy = scaled.height() / qreal(pixmap.height()); | - | ||||||||||||||||||||||||||||||
| 1307 | - | |||||||||||||||||||||||||||||||
| 1308 | drawPixmap(dest, scaled, scaleRect(src, sx, sy)); | - | ||||||||||||||||||||||||||||||
| 1309 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1310 | } | - | ||||||||||||||||||||||||||||||
| 1311 | - | |||||||||||||||||||||||||||||||
| 1312 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 1313 | d->transferMode(ImageDrawingMode); | - | ||||||||||||||||||||||||||||||
| 1314 | - | |||||||||||||||||||||||||||||||
| 1315 | QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption|QGLContext::CanFlipNativePixmapBindOption; | - | ||||||||||||||||||||||||||||||
| 1316 | - | |||||||||||||||||||||||||||||||
| 1317 | - | |||||||||||||||||||||||||||||||
| 1318 | - | |||||||||||||||||||||||||||||||
| 1319 | - | |||||||||||||||||||||||||||||||
| 1320 | d->glActiveTexture(0x84C0 + GLuint(0)); | - | ||||||||||||||||||||||||||||||
| 1321 | QGLTexture *texture = | - | ||||||||||||||||||||||||||||||
| 1322 | ctx->d_func()->bindTexture(pixmap, 0x0DE1, 0x1908, bindOptions); | - | ||||||||||||||||||||||||||||||
| 1323 | - | |||||||||||||||||||||||||||||||
| 1324 | GLfloat top = texture->options & QGLContext::InvertedYBindOption
| 0 | ||||||||||||||||||||||||||||||
| 1325 | GLfloat bottom = texture->options & QGLContext::InvertedYBindOption
| 0 | ||||||||||||||||||||||||||||||
| 1326 | QGLRect srcRect(src.left(), top, src.right(), bottom); | - | ||||||||||||||||||||||||||||||
| 1327 | - | |||||||||||||||||||||||||||||||
| 1328 | bool isBitmap = pixmap.isQBitmap(); | - | ||||||||||||||||||||||||||||||
| 1329 | bool isOpaque = !isBitmap
| 0 | ||||||||||||||||||||||||||||||
| 1330 | - | |||||||||||||||||||||||||||||||
| 1331 | d->updateTextureFilter(0x0DE1, 0x812F, | - | ||||||||||||||||||||||||||||||
| 1332 | state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); | - | ||||||||||||||||||||||||||||||
| 1333 | d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap); | - | ||||||||||||||||||||||||||||||
| 1334 | - | |||||||||||||||||||||||||||||||
| 1335 | if (texture->options&QGLContext::TemporarilyCachedBindOption
| 0 | ||||||||||||||||||||||||||||||
| 1336 | - | |||||||||||||||||||||||||||||||
| 1337 | - | |||||||||||||||||||||||||||||||
| 1338 | QGLTextureCache::instance()->remove(ctx, texture->id); | - | ||||||||||||||||||||||||||||||
| 1339 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1340 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1341 | - | |||||||||||||||||||||||||||||||
| 1342 | void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QRectF& src, | - | ||||||||||||||||||||||||||||||
| 1343 | Qt::ImageConversionFlags) | - | ||||||||||||||||||||||||||||||
| 1344 | { | - | ||||||||||||||||||||||||||||||
| 1345 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1346 | QGLContext *ctx = d->ctx; | - | ||||||||||||||||||||||||||||||
| 1347 | - | |||||||||||||||||||||||||||||||
| 1348 | int max_texture_size = ctx->d_func()->maxTextureSize(); | - | ||||||||||||||||||||||||||||||
| 1349 | if (image.width() > max_texture_size
| 0 | ||||||||||||||||||||||||||||||
| 1350 | QImage scaled = image.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); | - | ||||||||||||||||||||||||||||||
| 1351 | - | |||||||||||||||||||||||||||||||
| 1352 | const qreal sx = scaled.width() / qreal(image.width()); | - | ||||||||||||||||||||||||||||||
| 1353 | const qreal sy = scaled.height() / qreal(image.height()); | - | ||||||||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||||||||
| 1355 | drawImage(dest, scaled, scaleRect(src, sx, sy)); | - | ||||||||||||||||||||||||||||||
| 1356 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1357 | } | - | ||||||||||||||||||||||||||||||
| 1358 | - | |||||||||||||||||||||||||||||||
| 1359 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 1360 | d->transferMode(ImageDrawingMode); | - | ||||||||||||||||||||||||||||||
| 1361 | - | |||||||||||||||||||||||||||||||
| 1362 | d->glActiveTexture(0x84C0 + GLuint(0)); | - | ||||||||||||||||||||||||||||||
| 1363 | - | |||||||||||||||||||||||||||||||
| 1364 | QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption; | - | ||||||||||||||||||||||||||||||
| 1365 | - | |||||||||||||||||||||||||||||||
| 1366 | - | |||||||||||||||||||||||||||||||
| 1367 | - | |||||||||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||||||||
| 1369 | QGLTexture *texture = ctx->d_func()->bindTexture(image, 0x0DE1, 0x1908, bindOptions); | - | ||||||||||||||||||||||||||||||
| 1370 | GLuint id = texture->id; | - | ||||||||||||||||||||||||||||||
| 1371 | - | |||||||||||||||||||||||||||||||
| 1372 | d->updateTextureFilter(0x0DE1, 0x812F, | - | ||||||||||||||||||||||||||||||
| 1373 | state()->renderHints & QPainter::SmoothPixmapTransform, id); | - | ||||||||||||||||||||||||||||||
| 1374 | d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel()); | - | ||||||||||||||||||||||||||||||
| 1375 | - | |||||||||||||||||||||||||||||||
| 1376 | if (texture->options&QGLContext::TemporarilyCachedBindOption
| 0 | ||||||||||||||||||||||||||||||
| 1377 | - | |||||||||||||||||||||||||||||||
| 1378 | - | |||||||||||||||||||||||||||||||
| 1379 | QGLTextureCache::instance()->remove(ctx, texture->id); | - | ||||||||||||||||||||||||||||||
| 1380 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1381 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1382 | - | |||||||||||||||||||||||||||||||
| 1383 | void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) | - | ||||||||||||||||||||||||||||||
| 1384 | { | - | ||||||||||||||||||||||||||||||
| 1385 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1386 | - | |||||||||||||||||||||||||||||||
| 1387 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 1388 | - | |||||||||||||||||||||||||||||||
| 1389 | QPainterState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1390 | - | |||||||||||||||||||||||||||||||
| 1391 | - | |||||||||||||||||||||||||||||||
| 1392 | QFontEngine *fontEngine = textItem->fontEngine(); | - | ||||||||||||||||||||||||||||||
| 1393 | if (shouldDrawCachedGlyphs(fontEngine, s->matrix)
| 0 | ||||||||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||||||||
| 1395 | QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None
| 0 | ||||||||||||||||||||||||||||||
| 1396 | ? fontEngine->glyphFormat : d->glyphCacheFormat; | - | ||||||||||||||||||||||||||||||
| 1397 | - | |||||||||||||||||||||||||||||||
| 1398 | if (glyphFormat == QFontEngine::Format_A32
| 0 | ||||||||||||||||||||||||||||||
| 1399 | if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()
| 0 | ||||||||||||||||||||||||||||||
| 1400 | || d->device->alphaRequested()
| 0 | ||||||||||||||||||||||||||||||
| 1401 | || (s->composition_mode != QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1402 | && s->composition_mode != QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||||||||
| 1403 | { | - | ||||||||||||||||||||||||||||||
| 1404 | glyphFormat = QFontEngine::Format_A8; | - | ||||||||||||||||||||||||||||||
| 1405 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1406 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1407 | - | |||||||||||||||||||||||||||||||
| 1408 | d->drawCachedGlyphs(glyphFormat, textItem); | - | ||||||||||||||||||||||||||||||
| 1409 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1410 | QPaintEngineEx::drawStaticTextItem(textItem); | - | ||||||||||||||||||||||||||||||
| 1411 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1412 | } | - | ||||||||||||||||||||||||||||||
| 1413 | - | |||||||||||||||||||||||||||||||
| 1414 | bool QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src) | - | ||||||||||||||||||||||||||||||
| 1415 | { | - | ||||||||||||||||||||||||||||||
| 1416 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1417 | if (!d->shaderManager
| 0 | ||||||||||||||||||||||||||||||
| 1418 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1419 | - | |||||||||||||||||||||||||||||||
| 1420 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 1421 | d->transferMode(ImageDrawingMode); | - | ||||||||||||||||||||||||||||||
| 1422 | - | |||||||||||||||||||||||||||||||
| 1423 | d->glActiveTexture(0x84C0 + GLuint(0)); | - | ||||||||||||||||||||||||||||||
| 1424 | d->glBindTexture(0x0DE1, textureId); | - | ||||||||||||||||||||||||||||||
| 1425 | - | |||||||||||||||||||||||||||||||
| 1426 | QGLRect srcRect(src.left(), src.bottom(), src.right(), src.top()); | - | ||||||||||||||||||||||||||||||
| 1427 | - | |||||||||||||||||||||||||||||||
| 1428 | d->updateTextureFilter(0x0DE1, 0x812F, | - | ||||||||||||||||||||||||||||||
| 1429 | state()->renderHints & QPainter::SmoothPixmapTransform, textureId); | - | ||||||||||||||||||||||||||||||
| 1430 | d->drawTexture(dest, srcRect, size, false); | - | ||||||||||||||||||||||||||||||
| 1431 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 1432 | } | - | ||||||||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||||||||
| 1434 | void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem) | - | ||||||||||||||||||||||||||||||
| 1435 | { | - | ||||||||||||||||||||||||||||||
| 1436 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1437 | - | |||||||||||||||||||||||||||||||
| 1438 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 1439 | QGL2PaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1440 | - | |||||||||||||||||||||||||||||||
| 1441 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - | ||||||||||||||||||||||||||||||
| 1442 | - | |||||||||||||||||||||||||||||||
| 1443 | QTransform::TransformationType txtype = s->matrix.type(); | - | ||||||||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||||||||
| 1445 | QFontEngine::GlyphFormat glyphFormat = ti.fontEngine->glyphFormat != QFontEngine::Format_None
| 0 | ||||||||||||||||||||||||||||||
| 1446 | ? ti.fontEngine->glyphFormat : d->glyphCacheFormat; | - | ||||||||||||||||||||||||||||||
| 1447 | - | |||||||||||||||||||||||||||||||
| 1448 | if (glyphFormat == QFontEngine::Format_A32
| 0 | ||||||||||||||||||||||||||||||
| 1449 | if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()
| 0 | ||||||||||||||||||||||||||||||
| 1450 | || d->device->alphaRequested()
| 0 | ||||||||||||||||||||||||||||||
| 1451 | || (state()->composition_mode != QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1452 | && state()->composition_mode != QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||||||||
| 1453 | { | - | ||||||||||||||||||||||||||||||
| 1454 | glyphFormat = QFontEngine::Format_A8; | - | ||||||||||||||||||||||||||||||
| 1455 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1456 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1457 | - | |||||||||||||||||||||||||||||||
| 1458 | if (shouldDrawCachedGlyphs(ti.fontEngine, s->matrix)
| 0 | ||||||||||||||||||||||||||||||
| 1459 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||||||||||||||||||||
| 1460 | QVarLengthArray<glyph_t> glyphs; | - | ||||||||||||||||||||||||||||||
| 1461 | QTransform matrix = QTransform::fromTranslate(p.x(), p.y()); | - | ||||||||||||||||||||||||||||||
| 1462 | ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); | - | ||||||||||||||||||||||||||||||
| 1463 | - | |||||||||||||||||||||||||||||||
| 1464 | { | - | ||||||||||||||||||||||||||||||
| 1465 | QStaticTextItem staticTextItem; | - | ||||||||||||||||||||||||||||||
| 1466 | staticTextItem.setFontEngine(ti.fontEngine); | - | ||||||||||||||||||||||||||||||
| 1467 | staticTextItem.glyphs = glyphs.data(); | - | ||||||||||||||||||||||||||||||
| 1468 | staticTextItem.numGlyphs = glyphs.size(); | - | ||||||||||||||||||||||||||||||
| 1469 | staticTextItem.glyphPositions = positions.data(); | - | ||||||||||||||||||||||||||||||
| 1470 | - | |||||||||||||||||||||||||||||||
| 1471 | d->drawCachedGlyphs(glyphFormat, &staticTextItem); | - | ||||||||||||||||||||||||||||||
| 1472 | } | - | ||||||||||||||||||||||||||||||
| 1473 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1474 | } | - | ||||||||||||||||||||||||||||||
| 1475 | - | |||||||||||||||||||||||||||||||
| 1476 | QPaintEngineEx::drawTextItem(p, ti); | - | ||||||||||||||||||||||||||||||
| 1477 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1478 | - | |||||||||||||||||||||||||||||||
| 1479 | namespace { | - | ||||||||||||||||||||||||||||||
| 1480 | - | |||||||||||||||||||||||||||||||
| 1481 | class QOpenGLStaticTextUserData: public QStaticTextUserData | - | ||||||||||||||||||||||||||||||
| 1482 | { | - | ||||||||||||||||||||||||||||||
| 1483 | public: | - | ||||||||||||||||||||||||||||||
| 1484 | QOpenGLStaticTextUserData() | - | ||||||||||||||||||||||||||||||
| 1485 | : QStaticTextUserData(OpenGLUserData), cacheSize(0, 0), cacheSerialNumber(0) | - | ||||||||||||||||||||||||||||||
| 1486 | { | - | ||||||||||||||||||||||||||||||
| 1487 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1488 | - | |||||||||||||||||||||||||||||||
| 1489 | ~QOpenGLStaticTextUserData() | - | ||||||||||||||||||||||||||||||
| 1490 | { | - | ||||||||||||||||||||||||||||||
| 1491 | } | - | ||||||||||||||||||||||||||||||
| 1492 | - | |||||||||||||||||||||||||||||||
| 1493 | QSize cacheSize; | - | ||||||||||||||||||||||||||||||
| 1494 | QGL2PEXVertexArray vertexCoordinateArray; | - | ||||||||||||||||||||||||||||||
| 1495 | QGL2PEXVertexArray textureCoordinateArray; | - | ||||||||||||||||||||||||||||||
| 1496 | QFontEngine::GlyphFormat glyphFormat; | - | ||||||||||||||||||||||||||||||
| 1497 | int cacheSerialNumber; | - | ||||||||||||||||||||||||||||||
| 1498 | }; | - | ||||||||||||||||||||||||||||||
| 1499 | - | |||||||||||||||||||||||||||||||
| 1500 | } | - | ||||||||||||||||||||||||||||||
| 1501 | - | |||||||||||||||||||||||||||||||
| 1502 | - | |||||||||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||||||||
| 1504 | - | |||||||||||||||||||||||||||||||
| 1505 | void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat, | - | ||||||||||||||||||||||||||||||
| 1506 | QStaticTextItem *staticTextItem) | - | ||||||||||||||||||||||||||||||
| 1507 | { | - | ||||||||||||||||||||||||||||||
| 1508 | QGL2PaintEngineEx * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1509 | - | |||||||||||||||||||||||||||||||
| 1510 | QGL2PaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 1511 | - | |||||||||||||||||||||||||||||||
| 1512 | void *cacheKey = const_cast<QGLContext *>(QGLContextPrivate::contextGroup(ctx)->context()); | - | ||||||||||||||||||||||||||||||
| 1513 | bool recreateVertexArrays = false; | - | ||||||||||||||||||||||||||||||
| 1514 | - | |||||||||||||||||||||||||||||||
| 1515 | QTransform glyphCacheTransform; | - | ||||||||||||||||||||||||||||||
| 1516 | QFontEngine *fe = staticTextItem->fontEngine(); | - | ||||||||||||||||||||||||||||||
| 1517 | if (fe->supportsTransformation(s->matrix)
| 0 | ||||||||||||||||||||||||||||||
| 1518 | - | |||||||||||||||||||||||||||||||
| 1519 | - | |||||||||||||||||||||||||||||||
| 1520 | - | |||||||||||||||||||||||||||||||
| 1521 | glyphCacheTransform = s->matrix.type() < QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 1522 | QTransform::fromScale(qAbs(s->matrix.m11()), qAbs(s->matrix.m22())) : | - | ||||||||||||||||||||||||||||||
| 1523 | QTransform::fromScale( | - | ||||||||||||||||||||||||||||||
| 1524 | QVector2D(s->matrix.m11(), s->matrix.m12()).length(), | - | ||||||||||||||||||||||||||||||
| 1525 | QVector2D(s->matrix.m21(), s->matrix.m22()).length()); | - | ||||||||||||||||||||||||||||||
| 1526 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1527 | - | |||||||||||||||||||||||||||||||
| 1528 | QGLTextureGlyphCache *cache = | - | ||||||||||||||||||||||||||||||
| 1529 | (QGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphFormat, glyphCacheTransform); | - | ||||||||||||||||||||||||||||||
| 1530 | if (!cache
| 0 | ||||||||||||||||||||||||||||||
| 1531 | cache = new QGLTextureGlyphCache(glyphFormat, glyphCacheTransform); | - | ||||||||||||||||||||||||||||||
| 1532 | fe->setGlyphCache(cacheKey, cache); | - | ||||||||||||||||||||||||||||||
| 1533 | recreateVertexArrays = true; | - | ||||||||||||||||||||||||||||||
| 1534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1535 | - | |||||||||||||||||||||||||||||||
| 1536 | if (staticTextItem->userDataNeedsUpdate
| 0 | ||||||||||||||||||||||||||||||
| 1537 | recreateVertexArrays = true; | - | ||||||||||||||||||||||||||||||
| 1538 | } never executed: else if (staticTextItem->userData() == 0end of block
| 0 | ||||||||||||||||||||||||||||||
| 1539 | recreateVertexArrays = true; | - | ||||||||||||||||||||||||||||||
| 1540 | } never executed: else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserDataend of block
| 0 | ||||||||||||||||||||||||||||||
| 1541 | recreateVertexArrays = true; | - | ||||||||||||||||||||||||||||||
| 1542 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1543 | QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData()); | - | ||||||||||||||||||||||||||||||
| 1544 | if (userData->glyphFormat != glyphFormat
| 0 | ||||||||||||||||||||||||||||||
| 1545 | recreateVertexArrays = true; | - | ||||||||||||||||||||||||||||||
| 1546 | } never executed: else if (userData->cacheSerialNumber != cache->serialNumber()end of block
| 0 | ||||||||||||||||||||||||||||||
| 1547 | recreateVertexArrays = true; | - | ||||||||||||||||||||||||||||||
| 1548 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1549 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1550 | - | |||||||||||||||||||||||||||||||
| 1551 | - | |||||||||||||||||||||||||||||||
| 1552 | - | |||||||||||||||||||||||||||||||
| 1553 | - | |||||||||||||||||||||||||||||||
| 1554 | if (recreateVertexArrays
| 0 | ||||||||||||||||||||||||||||||
| 1555 | cache->setPaintEnginePrivate(this); | - | ||||||||||||||||||||||||||||||
| 1556 | if (!cache->populate(fe, staticTextItem->numGlyphs,
| 0 | ||||||||||||||||||||||||||||||
| 1557 | staticTextItem->glyphs, staticTextItem->glyphPositions)
| 0 | ||||||||||||||||||||||||||||||
| 1558 | - | |||||||||||||||||||||||||||||||
| 1559 | cache->clear(); | - | ||||||||||||||||||||||||||||||
| 1560 | cache->populate(fe, staticTextItem->numGlyphs, | - | ||||||||||||||||||||||||||||||
| 1561 | staticTextItem->glyphs, staticTextItem->glyphPositions); | - | ||||||||||||||||||||||||||||||
| 1562 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1563 | cache->fillInPendingGlyphs(); | - | ||||||||||||||||||||||||||||||
| 1564 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1565 | - | |||||||||||||||||||||||||||||||
| 1566 | if (cache->width() == 0
| 0 | ||||||||||||||||||||||||||||||
| 1567 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||||||||
| 1569 | transferMode(TextDrawingMode); | - | ||||||||||||||||||||||||||||||
| 1570 | - | |||||||||||||||||||||||||||||||
| 1571 | int margin = fe->glyphMargin(glyphFormat); | - | ||||||||||||||||||||||||||||||
| 1572 | - | |||||||||||||||||||||||||||||||
| 1573 | GLfloat dx = 1.0 / cache->width(); | - | ||||||||||||||||||||||||||||||
| 1574 | GLfloat dy = 1.0 / cache->height(); | - | ||||||||||||||||||||||||||||||
| 1575 | - | |||||||||||||||||||||||||||||||
| 1576 | - | |||||||||||||||||||||||||||||||
| 1577 | QGL2PEXVertexArray *vertexCoordinates = &vertexCoordinateArray; | - | ||||||||||||||||||||||||||||||
| 1578 | QGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray; | - | ||||||||||||||||||||||||||||||
| 1579 | - | |||||||||||||||||||||||||||||||
| 1580 | if (staticTextItem->useBackendOptimizations
| 0 | ||||||||||||||||||||||||||||||
| 1581 | QOpenGLStaticTextUserData *userData = 0; | - | ||||||||||||||||||||||||||||||
| 1582 | - | |||||||||||||||||||||||||||||||
| 1583 | if (staticTextItem->userData() == 0
| 0 | ||||||||||||||||||||||||||||||
| 1584 | || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData
| 0 | ||||||||||||||||||||||||||||||
| 1585 | - | |||||||||||||||||||||||||||||||
| 1586 | userData = new QOpenGLStaticTextUserData(); | - | ||||||||||||||||||||||||||||||
| 1587 | staticTextItem->setUserData(userData); | - | ||||||||||||||||||||||||||||||
| 1588 | - | |||||||||||||||||||||||||||||||
| 1589 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1590 | userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData()); | - | ||||||||||||||||||||||||||||||
| 1591 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1592 | - | |||||||||||||||||||||||||||||||
| 1593 | userData->glyphFormat = glyphFormat; | - | ||||||||||||||||||||||||||||||
| 1594 | userData->cacheSerialNumber = cache->serialNumber(); | - | ||||||||||||||||||||||||||||||
| 1595 | - | |||||||||||||||||||||||||||||||
| 1596 | - | |||||||||||||||||||||||||||||||
| 1597 | vertexCoordinates = &userData->vertexCoordinateArray; | - | ||||||||||||||||||||||||||||||
| 1598 | textureCoordinates = &userData->textureCoordinateArray; | - | ||||||||||||||||||||||||||||||
| 1599 | - | |||||||||||||||||||||||||||||||
| 1600 | QSize size(cache->width(), cache->height()); | - | ||||||||||||||||||||||||||||||
| 1601 | if (userData->cacheSize != size
| 0 | ||||||||||||||||||||||||||||||
| 1602 | recreateVertexArrays = true; | - | ||||||||||||||||||||||||||||||
| 1603 | userData->cacheSize = size; | - | ||||||||||||||||||||||||||||||
| 1604 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1605 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1606 | - | |||||||||||||||||||||||||||||||
| 1607 | if (recreateVertexArrays
| 0 | ||||||||||||||||||||||||||||||
| 1608 | vertexCoordinates->clear(); | - | ||||||||||||||||||||||||||||||
| 1609 | textureCoordinates->clear(); | - | ||||||||||||||||||||||||||||||
| 1610 | - | |||||||||||||||||||||||||||||||
| 1611 | bool supportsSubPixelPositions = fe->supportsSubPixelPositions(); | - | ||||||||||||||||||||||||||||||
| 1612 | for (int i=0; i<staticTextItem->numGlyphs
| 0 | ||||||||||||||||||||||||||||||
| 1613 | QFixed subPixelPosition; | - | ||||||||||||||||||||||||||||||
| 1614 | if (supportsSubPixelPositions
| 0 | ||||||||||||||||||||||||||||||
| 1615 | subPixelPosition = fe->subPixelPositionForX(staticTextItem->glyphPositions[i].x); never executed: subPixelPosition = fe->subPixelPositionForX(staticTextItem->glyphPositions[i].x); | 0 | ||||||||||||||||||||||||||||||
| 1616 | - | |||||||||||||||||||||||||||||||
| 1617 | QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition); | - | ||||||||||||||||||||||||||||||
| 1618 | - | |||||||||||||||||||||||||||||||
| 1619 | const QTextureGlyphCache::Coord &c = cache->coords[glyph]; | - | ||||||||||||||||||||||||||||||
| 1620 | if (c.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 1621 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 1622 | - | |||||||||||||||||||||||||||||||
| 1623 | int x = qFloor(staticTextItem->glyphPositions[i].x.toReal() * cache->transform().m11()) + c.baseLineX - margin; | - | ||||||||||||||||||||||||||||||
| 1624 | int y = qRound(staticTextItem->glyphPositions[i].y.toReal() * cache->transform().m22()) - c.baseLineY - margin; | - | ||||||||||||||||||||||||||||||
| 1625 | - | |||||||||||||||||||||||||||||||
| 1626 | vertexCoordinates->addQuad(QRectF(x, y, c.w, c.h)); | - | ||||||||||||||||||||||||||||||
| 1627 | textureCoordinates->addQuad(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy)); | - | ||||||||||||||||||||||||||||||
| 1628 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1629 | - | |||||||||||||||||||||||||||||||
| 1630 | staticTextItem->userDataNeedsUpdate = false; | - | ||||||||||||||||||||||||||||||
| 1631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1632 | - | |||||||||||||||||||||||||||||||
| 1633 | int numGlyphs = vertexCoordinates->vertexCount() / 4; | - | ||||||||||||||||||||||||||||||
| 1634 | if (numGlyphs == 0
| 0 | ||||||||||||||||||||||||||||||
| 1635 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1636 | - | |||||||||||||||||||||||||||||||
| 1637 | if (elementIndices.size() < numGlyphs*6
| 0 | ||||||||||||||||||||||||||||||
| 1638 | ((!(elementIndices.size() % 6 == 0)) ? qt_assert("elementIndices.size() % 6 == 0",__FILE__,1763) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1639 | int j = elementIndices.size() / 6 * 4; | - | ||||||||||||||||||||||||||||||
| 1640 | while (j < numGlyphs*4
| 0 | ||||||||||||||||||||||||||||||
| 1641 | elementIndices.append(j + 0); | - | ||||||||||||||||||||||||||||||
| 1642 | elementIndices.append(j + 0); | - | ||||||||||||||||||||||||||||||
| 1643 | elementIndices.append(j + 1); | - | ||||||||||||||||||||||||||||||
| 1644 | elementIndices.append(j + 2); | - | ||||||||||||||||||||||||||||||
| 1645 | elementIndices.append(j + 3); | - | ||||||||||||||||||||||||||||||
| 1646 | elementIndices.append(j + 3); | - | ||||||||||||||||||||||||||||||
| 1647 | - | |||||||||||||||||||||||||||||||
| 1648 | j += 4; | - | ||||||||||||||||||||||||||||||
| 1649 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1650 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1651 | - | |||||||||||||||||||||||||||||||
| 1652 | - | |||||||||||||||||||||||||||||||
| 1653 | - | |||||||||||||||||||||||||||||||
| 1654 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1655 | - | |||||||||||||||||||||||||||||||
| 1656 | setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinates->data()); | - | ||||||||||||||||||||||||||||||
| 1657 | setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinates->data()); | - | ||||||||||||||||||||||||||||||
| 1658 | - | |||||||||||||||||||||||||||||||
| 1659 | if (!snapToPixelGrid
| 0 | ||||||||||||||||||||||||||||||
| 1660 | snapToPixelGrid = true; | - | ||||||||||||||||||||||||||||||
| 1661 | matrixDirty = true; | - | ||||||||||||||||||||||||||||||
| 1662 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||||||||
| 1664 | QBrush pensBrush = q->state()->pen.brush(); | - | ||||||||||||||||||||||||||||||
| 1665 | setBrush(pensBrush); | - | ||||||||||||||||||||||||||||||
| 1666 | - | |||||||||||||||||||||||||||||||
| 1667 | if (glyphFormat == QFontEngine::Format_A32
| 0 | ||||||||||||||||||||||||||||||
| 1668 | - | |||||||||||||||||||||||||||||||
| 1669 | - | |||||||||||||||||||||||||||||||
| 1670 | - | |||||||||||||||||||||||||||||||
| 1671 | QPainter::CompositionMode compMode = q->state()->composition_mode; | - | ||||||||||||||||||||||||||||||
| 1672 | ((!(compMode == QPainter::CompositionMode_Source || compMode == QPainter::CompositionMode_SourceOver)) ? qt_assert("compMode == QPainter::CompositionMode_Source || compMode == QPainter::CompositionMode_SourceOver", | - | ||||||||||||||||||||||||||||||
| 1673 | __FILE__ | - | ||||||||||||||||||||||||||||||
| 1674 | , | - | ||||||||||||||||||||||||||||||
| 1675 | 1807 | - | ||||||||||||||||||||||||||||||
| 1676 | ) : qt_noop()) | - | ||||||||||||||||||||||||||||||
| 1677 | ; | - | ||||||||||||||||||||||||||||||
| 1678 | - | |||||||||||||||||||||||||||||||
| 1679 | shaderManager->setMaskType(QGLEngineShaderManager::SubPixelMaskPass1); | - | ||||||||||||||||||||||||||||||
| 1680 | - | |||||||||||||||||||||||||||||||
| 1681 | if (pensBrush.style() == Qt::SolidPattern
| 0 | ||||||||||||||||||||||||||||||
| 1682 | - | |||||||||||||||||||||||||||||||
| 1683 | QColor c = pensBrush.color(); | - | ||||||||||||||||||||||||||||||
| 1684 | qreal oldOpacity = q->state()->opacity; | - | ||||||||||||||||||||||||||||||
| 1685 | if (compMode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1686 | c = qt_premultiplyColor(c, q->state()->opacity); | - | ||||||||||||||||||||||||||||||
| 1687 | q->state()->opacity = 1; | - | ||||||||||||||||||||||||||||||
| 1688 | opacityUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1689 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1690 | - | |||||||||||||||||||||||||||||||
| 1691 | compositionModeDirty = false; | - | ||||||||||||||||||||||||||||||
| 1692 | prepareForCachedGlyphDraw(*cache); | - | ||||||||||||||||||||||||||||||
| 1693 | - | |||||||||||||||||||||||||||||||
| 1694 | - | |||||||||||||||||||||||||||||||
| 1695 | if (compMode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1696 | q->state()->opacity = oldOpacity; | - | ||||||||||||||||||||||||||||||
| 1697 | opacityUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1698 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1699 | - | |||||||||||||||||||||||||||||||
| 1700 | glEnable(0x0BE2); | - | ||||||||||||||||||||||||||||||
| 1701 | glBlendFunc(0x8001, 0x0301); | - | ||||||||||||||||||||||||||||||
| 1702 | glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); | - | ||||||||||||||||||||||||||||||
| 1703 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1704 | - | |||||||||||||||||||||||||||||||
| 1705 | - | |||||||||||||||||||||||||||||||
| 1706 | qreal oldOpacity = q->state()->opacity; | - | ||||||||||||||||||||||||||||||
| 1707 | if (compMode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1708 | q->state()->opacity = 1; | - | ||||||||||||||||||||||||||||||
| 1709 | opacityUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1710 | pensBrush = Qt::white; | - | ||||||||||||||||||||||||||||||
| 1711 | setBrush(pensBrush); | - | ||||||||||||||||||||||||||||||
| 1712 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1713 | - | |||||||||||||||||||||||||||||||
| 1714 | compositionModeDirty = false; | - | ||||||||||||||||||||||||||||||
| 1715 | prepareForCachedGlyphDraw(*cache); | - | ||||||||||||||||||||||||||||||
| 1716 | glEnable(0x0BE2); | - | ||||||||||||||||||||||||||||||
| 1717 | glBlendFunc(0, 0x0301); | - | ||||||||||||||||||||||||||||||
| 1718 | - | |||||||||||||||||||||||||||||||
| 1719 | glActiveTexture(0x84C0 + GLuint(1)); | - | ||||||||||||||||||||||||||||||
| 1720 | glBindTexture(0x0DE1, cache->texture()); | - | ||||||||||||||||||||||||||||||
| 1721 | updateTextureFilter(0x0DE1, 0x2901, false); | - | ||||||||||||||||||||||||||||||
| 1722 | - | |||||||||||||||||||||||||||||||
| 1723 | - | |||||||||||||||||||||||||||||||
| 1724 | - | |||||||||||||||||||||||||||||||
| 1725 | - | |||||||||||||||||||||||||||||||
| 1726 | glDrawElements(0x0005, 6 * numGlyphs, 0x1403, elementIndices.data()); | - | ||||||||||||||||||||||||||||||
| 1727 | - | |||||||||||||||||||||||||||||||
| 1728 | - | |||||||||||||||||||||||||||||||
| 1729 | shaderManager->setMaskType(QGLEngineShaderManager::SubPixelMaskPass2); | - | ||||||||||||||||||||||||||||||
| 1730 | - | |||||||||||||||||||||||||||||||
| 1731 | if (compMode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1732 | q->state()->opacity = oldOpacity; | - | ||||||||||||||||||||||||||||||
| 1733 | opacityUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1734 | pensBrush = q->state()->pen.brush(); | - | ||||||||||||||||||||||||||||||
| 1735 | setBrush(pensBrush); | - | ||||||||||||||||||||||||||||||
| 1736 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1737 | - | |||||||||||||||||||||||||||||||
| 1738 | compositionModeDirty = false; | - | ||||||||||||||||||||||||||||||
| 1739 | prepareForCachedGlyphDraw(*cache); | - | ||||||||||||||||||||||||||||||
| 1740 | glEnable(0x0BE2); | - | ||||||||||||||||||||||||||||||
| 1741 | glBlendFunc(1, 1); | - | ||||||||||||||||||||||||||||||
| 1742 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1743 | compositionModeDirty = true; | - | ||||||||||||||||||||||||||||||
| 1744 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1745 | - | |||||||||||||||||||||||||||||||
| 1746 | - | |||||||||||||||||||||||||||||||
| 1747 | shaderManager->setMaskType(QGLEngineShaderManager::PixelMask); | - | ||||||||||||||||||||||||||||||
| 1748 | prepareForCachedGlyphDraw(*cache); | - | ||||||||||||||||||||||||||||||
| 1749 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1750 | - | |||||||||||||||||||||||||||||||
| 1751 | QGLTextureGlyphCache::FilterMode filterMode = (
| 0 | ||||||||||||||||||||||||||||||
| 1752 | if (lastMaskTextureUsed != cache->texture()
| 0 | ||||||||||||||||||||||||||||||
| 1753 | - | |||||||||||||||||||||||||||||||
| 1754 | glActiveTexture(0x84C0 + GLuint(1)); | - | ||||||||||||||||||||||||||||||
| 1755 | if (lastMaskTextureUsed != cache->texture()
| 0 | ||||||||||||||||||||||||||||||
| 1756 | glBindTexture(0x0DE1, cache->texture()); | - | ||||||||||||||||||||||||||||||
| 1757 | lastMaskTextureUsed = cache->texture(); | - | ||||||||||||||||||||||||||||||
| 1758 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1759 | - | |||||||||||||||||||||||||||||||
| 1760 | if (cache->filterMode() != filterMode
| 0 | ||||||||||||||||||||||||||||||
| 1761 | if (filterMode == QGLTextureGlyphCache::Linear
| 0 | ||||||||||||||||||||||||||||||
| 1762 | glTexParameteri(0x0DE1, 0x2800, 0x2601); | - | ||||||||||||||||||||||||||||||
| 1763 | glTexParameteri(0x0DE1, 0x2801, 0x2601); | - | ||||||||||||||||||||||||||||||
| 1764 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1765 | glTexParameteri(0x0DE1, 0x2800, 0x2600); | - | ||||||||||||||||||||||||||||||
| 1766 | glTexParameteri(0x0DE1, 0x2801, 0x2600); | - | ||||||||||||||||||||||||||||||
| 1767 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1768 | cache->setFilterMode(filterMode); | - | ||||||||||||||||||||||||||||||
| 1769 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1770 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1771 | - | |||||||||||||||||||||||||||||||
| 1772 | - | |||||||||||||||||||||||||||||||
| 1773 | - | |||||||||||||||||||||||||||||||
| 1774 | - | |||||||||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||||||||
| 1776 | glDrawElements(0x0005, 6 * numGlyphs, 0x1403, elementIndices.data()); | - | ||||||||||||||||||||||||||||||
| 1777 | - | |||||||||||||||||||||||||||||||
| 1778 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1779 | - | |||||||||||||||||||||||||||||||
| 1780 | void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, | - | ||||||||||||||||||||||||||||||
| 1781 | QPainter::PixmapFragmentHints hints) | - | ||||||||||||||||||||||||||||||
| 1782 | { | - | ||||||||||||||||||||||||||||||
| 1783 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1784 | - | |||||||||||||||||||||||||||||||
| 1785 | if (state()->composition_mode > QPainter::CompositionMode_Plus
| 0 | ||||||||||||||||||||||||||||||
| 1786 | QPaintEngineEx::drawPixmapFragments(fragments, fragmentCount, pixmap, hints); | - | ||||||||||||||||||||||||||||||
| 1787 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1788 | } | - | ||||||||||||||||||||||||||||||
| 1789 | - | |||||||||||||||||||||||||||||||
| 1790 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 1791 | int max_texture_size = d->ctx->d_func()->maxTextureSize(); | - | ||||||||||||||||||||||||||||||
| 1792 | if (pixmap.width() > max_texture_size
| 0 | ||||||||||||||||||||||||||||||
| 1793 | QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); | - | ||||||||||||||||||||||||||||||
| 1794 | d->drawPixmapFragments(fragments, fragmentCount, scaled, hints); | - | ||||||||||||||||||||||||||||||
| 1795 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1796 | d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); | - | ||||||||||||||||||||||||||||||
| 1797 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1798 | } | - | ||||||||||||||||||||||||||||||
| 1799 | - | |||||||||||||||||||||||||||||||
| 1800 | - | |||||||||||||||||||||||||||||||
| 1801 | void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragment *fragments, | - | ||||||||||||||||||||||||||||||
| 1802 | int fragmentCount, const QPixmap &pixmap, | - | ||||||||||||||||||||||||||||||
| 1803 | QPainter::PixmapFragmentHints hints) | - | ||||||||||||||||||||||||||||||
| 1804 | { | - | ||||||||||||||||||||||||||||||
| 1805 | GLfloat dx = 1.0f / pixmap.size().width(); | - | ||||||||||||||||||||||||||||||
| 1806 | GLfloat dy = 1.0f / pixmap.size().height(); | - | ||||||||||||||||||||||||||||||
| 1807 | - | |||||||||||||||||||||||||||||||
| 1808 | vertexCoordinateArray.clear(); | - | ||||||||||||||||||||||||||||||
| 1809 | textureCoordinateArray.clear(); | - | ||||||||||||||||||||||||||||||
| 1810 | opacityArray.reset(); | - | ||||||||||||||||||||||||||||||
| 1811 | - | |||||||||||||||||||||||||||||||
| 1812 | if (snapToPixelGrid
| 0 | ||||||||||||||||||||||||||||||
| 1813 | snapToPixelGrid = false; | - | ||||||||||||||||||||||||||||||
| 1814 | matrixDirty = true; | - | ||||||||||||||||||||||||||||||
| 1815 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1816 | - | |||||||||||||||||||||||||||||||
| 1817 | bool allOpaque = true; | - | ||||||||||||||||||||||||||||||
| 1818 | - | |||||||||||||||||||||||||||||||
| 1819 | for (int i = 0; i < fragmentCount
| 0 | ||||||||||||||||||||||||||||||
| 1820 | qreal s = 0; | - | ||||||||||||||||||||||||||||||
| 1821 | qreal c = 1; | - | ||||||||||||||||||||||||||||||
| 1822 | if (fragments[i].rotation != 0
| 0 | ||||||||||||||||||||||||||||||
| 1823 | s = qFastSin(qDegreesToRadians(fragments[i].rotation)); | - | ||||||||||||||||||||||||||||||
| 1824 | c = qFastCos(qDegreesToRadians(fragments[i].rotation)); | - | ||||||||||||||||||||||||||||||
| 1825 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1826 | - | |||||||||||||||||||||||||||||||
| 1827 | qreal right = 0.5 * fragments[i].scaleX * fragments[i].width; | - | ||||||||||||||||||||||||||||||
| 1828 | qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height; | - | ||||||||||||||||||||||||||||||
| 1829 | QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c); | - | ||||||||||||||||||||||||||||||
| 1830 | QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c); | - | ||||||||||||||||||||||||||||||
| 1831 | - | |||||||||||||||||||||||||||||||
| 1832 | vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); | - | ||||||||||||||||||||||||||||||
| 1833 | vertexCoordinateArray.addVertex(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y); | - | ||||||||||||||||||||||||||||||
| 1834 | vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); | - | ||||||||||||||||||||||||||||||
| 1835 | vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); | - | ||||||||||||||||||||||||||||||
| 1836 | vertexCoordinateArray.addVertex(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y); | - | ||||||||||||||||||||||||||||||
| 1837 | vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); | - | ||||||||||||||||||||||||||||||
| 1838 | - | |||||||||||||||||||||||||||||||
| 1839 | QGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy, | - | ||||||||||||||||||||||||||||||
| 1840 | (fragments[i].sourceLeft + fragments[i].width) * dx, | - | ||||||||||||||||||||||||||||||
| 1841 | (fragments[i].sourceTop + fragments[i].height) * dy); | - | ||||||||||||||||||||||||||||||
| 1842 | - | |||||||||||||||||||||||||||||||
| 1843 | textureCoordinateArray.addVertex(src.right, src.bottom); | - | ||||||||||||||||||||||||||||||
| 1844 | textureCoordinateArray.addVertex(src.right, src.top); | - | ||||||||||||||||||||||||||||||
| 1845 | textureCoordinateArray.addVertex(src.left, src.top); | - | ||||||||||||||||||||||||||||||
| 1846 | textureCoordinateArray.addVertex(src.left, src.top); | - | ||||||||||||||||||||||||||||||
| 1847 | textureCoordinateArray.addVertex(src.left, src.bottom); | - | ||||||||||||||||||||||||||||||
| 1848 | textureCoordinateArray.addVertex(src.right, src.bottom); | - | ||||||||||||||||||||||||||||||
| 1849 | - | |||||||||||||||||||||||||||||||
| 1850 | qreal opacity = fragments[i].opacity * q->state()->opacity; | - | ||||||||||||||||||||||||||||||
| 1851 | opacityArray << opacity << opacity << opacity << opacity << opacity << opacity; | - | ||||||||||||||||||||||||||||||
| 1852 | allOpaque &= (opacity >= 0.99f); | - | ||||||||||||||||||||||||||||||
| 1853 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1854 | - | |||||||||||||||||||||||||||||||
| 1855 | glActiveTexture(0x84C0 + GLuint(0)); | - | ||||||||||||||||||||||||||||||
| 1856 | QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, 0x0DE1, 0x1908, | - | ||||||||||||||||||||||||||||||
| 1857 | QGLContext::InternalBindOption | - | ||||||||||||||||||||||||||||||
| 1858 | | QGLContext::CanFlipNativePixmapBindOption); | - | ||||||||||||||||||||||||||||||
| 1859 | - | |||||||||||||||||||||||||||||||
| 1860 | if (texture->options & QGLContext::InvertedYBindOption
| 0 | ||||||||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||||||||
| 1862 | QGLPoint *data = textureCoordinateArray.data(); | - | ||||||||||||||||||||||||||||||
| 1863 | for (int i = 0; i < 6 * fragmentCount
| 0 | ||||||||||||||||||||||||||||||
| 1864 | data[i].y = 1 - data[i].y; never executed: data[i].y = 1 - data[i].y; | 0 | ||||||||||||||||||||||||||||||
| 1865 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1866 | - | |||||||||||||||||||||||||||||||
| 1867 | transferMode(ImageArrayDrawingMode); | - | ||||||||||||||||||||||||||||||
| 1868 | - | |||||||||||||||||||||||||||||||
| 1869 | bool isBitmap = pixmap.isQBitmap(); | - | ||||||||||||||||||||||||||||||
| 1870 | bool isOpaque = !isBitmap
| 0 | ||||||||||||||||||||||||||||||
| 1871 | - | |||||||||||||||||||||||||||||||
| 1872 | updateTextureFilter(0x0DE1, 0x812F, | - | ||||||||||||||||||||||||||||||
| 1873 | q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); | - | ||||||||||||||||||||||||||||||
| 1874 | - | |||||||||||||||||||||||||||||||
| 1875 | - | |||||||||||||||||||||||||||||||
| 1876 | currentBrush = noBrush; | - | ||||||||||||||||||||||||||||||
| 1877 | shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc | - | ||||||||||||||||||||||||||||||
| 1878 | : QGLEngineShaderManager::ImageSrc); | - | ||||||||||||||||||||||||||||||
| 1879 | if (prepareForDraw(isOpaque)
| 0 | ||||||||||||||||||||||||||||||
| 1880 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), GLuint(0)); never executed: shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), GLuint(0)); | 0 | ||||||||||||||||||||||||||||||
| 1881 | - | |||||||||||||||||||||||||||||||
| 1882 | if (isBitmap
| 0 | ||||||||||||||||||||||||||||||
| 1883 | QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); | - | ||||||||||||||||||||||||||||||
| 1884 | shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); | - | ||||||||||||||||||||||||||||||
| 1885 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1886 | - | |||||||||||||||||||||||||||||||
| 1887 | glDrawArrays(0x0004, 0, 6 * fragmentCount); | - | ||||||||||||||||||||||||||||||
| 1888 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1889 | - | |||||||||||||||||||||||||||||||
| 1890 | bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) | - | ||||||||||||||||||||||||||||||
| 1891 | { | - | ||||||||||||||||||||||||||||||
| 1892 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1893 | - | |||||||||||||||||||||||||||||||
| 1894 | - | |||||||||||||||||||||||||||||||
| 1895 | if (pdev->devType() == QInternal::OpenGL
| 0-3 | ||||||||||||||||||||||||||||||
| 1896 | d->device = static_cast<QGLPaintDevice*>(pdev); never executed: d->device = static_cast<QGLPaintDevice*>(pdev); | 0 | ||||||||||||||||||||||||||||||
| 1897 | else | - | ||||||||||||||||||||||||||||||
| 1898 | d->device = QGLPaintDevice::getDevice(pdev); executed 3 times by 1 test: d->device = QGLPaintDevice::getDevice(pdev);Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 1899 | - | |||||||||||||||||||||||||||||||
| 1900 | if (!d->device
| 0-3 | ||||||||||||||||||||||||||||||
| 1901 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1902 | - | |||||||||||||||||||||||||||||||
| 1903 | d->ctx = d->device->context(); | - | ||||||||||||||||||||||||||||||
| 1904 | d->ctx->d_ptr->active_engine = this; | - | ||||||||||||||||||||||||||||||
| 1905 | - | |||||||||||||||||||||||||||||||
| 1906 | d->resetOpenGLContextActiveEngine(); | - | ||||||||||||||||||||||||||||||
| 1907 | - | |||||||||||||||||||||||||||||||
| 1908 | const QSize sz = d->device->size(); | - | ||||||||||||||||||||||||||||||
| 1909 | d->width = sz.width(); | - | ||||||||||||||||||||||||||||||
| 1910 | d->height = sz.height(); | - | ||||||||||||||||||||||||||||||
| 1911 | d->mode = BrushDrawingMode; | - | ||||||||||||||||||||||||||||||
| 1912 | d->brushTextureDirty = true; | - | ||||||||||||||||||||||||||||||
| 1913 | d->brushUniformsDirty = true; | - | ||||||||||||||||||||||||||||||
| 1914 | d->matrixUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1915 | d->matrixDirty = true; | - | ||||||||||||||||||||||||||||||
| 1916 | d->compositionModeDirty = true; | - | ||||||||||||||||||||||||||||||
| 1917 | d->opacityUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1918 | d->translateZUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 1919 | d->needsSync = true; | - | ||||||||||||||||||||||||||||||
| 1920 | d->useSystemClip = !systemClip().isEmpty(); | - | ||||||||||||||||||||||||||||||
| 1921 | d->currentBrush = QBrush(); | - | ||||||||||||||||||||||||||||||
| 1922 | - | |||||||||||||||||||||||||||||||
| 1923 | d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); | - | ||||||||||||||||||||||||||||||
| 1924 | d->stencilClean = true; | - | ||||||||||||||||||||||||||||||
| 1925 | - | |||||||||||||||||||||||||||||||
| 1926 | - | |||||||||||||||||||||||||||||||
| 1927 | - | |||||||||||||||||||||||||||||||
| 1928 | - | |||||||||||||||||||||||||||||||
| 1929 | d->device->beginPaint(); | - | ||||||||||||||||||||||||||||||
| 1930 | - | |||||||||||||||||||||||||||||||
| 1931 | d->initializeOpenGLFunctions(); | - | ||||||||||||||||||||||||||||||
| 1932 | - | |||||||||||||||||||||||||||||||
| 1933 | d->shaderManager = new QGLEngineShaderManager(d->ctx); | - | ||||||||||||||||||||||||||||||
| 1934 | - | |||||||||||||||||||||||||||||||
| 1935 | d->glDisable(0x0B90); | - | ||||||||||||||||||||||||||||||
| 1936 | d->glDisable(0x0B71); | - | ||||||||||||||||||||||||||||||
| 1937 | d->glDisable(0x0C11); | - | ||||||||||||||||||||||||||||||
| 1938 | - | |||||||||||||||||||||||||||||||
| 1939 | - | |||||||||||||||||||||||||||||||
| 1940 | if (!d->ctx->contextHandle()->isOpenGLES()
| 0-3 | ||||||||||||||||||||||||||||||
| 1941 | d->glDisable(0x809D); executed 3 times by 1 test: d->glDisable(0x809D);Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 1942 | - | |||||||||||||||||||||||||||||||
| 1943 | - | |||||||||||||||||||||||||||||||
| 1944 | d->glyphCacheFormat = QFontEngine::Format_A8; | - | ||||||||||||||||||||||||||||||
| 1945 | - | |||||||||||||||||||||||||||||||
| 1946 | - | |||||||||||||||||||||||||||||||
| 1947 | if (!d->ctx->contextHandle()->isOpenGLES()
| 0-3 | ||||||||||||||||||||||||||||||
| 1948 | d->glyphCacheFormat = QFontEngine::Format_A32; | - | ||||||||||||||||||||||||||||||
| 1949 | d->multisamplingAlwaysEnabled = false; | - | ||||||||||||||||||||||||||||||
| 1950 | } executed 3 times by 1 test: else {end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 1951 | d->multisamplingAlwaysEnabled = d->device->format().sampleBuffers(); | - | ||||||||||||||||||||||||||||||
| 1952 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1953 | - | |||||||||||||||||||||||||||||||
| 1954 | - | |||||||||||||||||||||||||||||||
| 1955 | - | |||||||||||||||||||||||||||||||
| 1956 | - | |||||||||||||||||||||||||||||||
| 1957 | - | |||||||||||||||||||||||||||||||
| 1958 | - | |||||||||||||||||||||||||||||||
| 1959 | return executed 3 times by 1 test: true;return true;Executed by:
executed 3 times by 1 test: return true;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 1960 | } | - | ||||||||||||||||||||||||||||||
| 1961 | - | |||||||||||||||||||||||||||||||
| 1962 | bool QGL2PaintEngineEx::end() | - | ||||||||||||||||||||||||||||||
| 1963 | { | - | ||||||||||||||||||||||||||||||
| 1964 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1965 | - | |||||||||||||||||||||||||||||||
| 1966 | QGLContext *ctx = d->ctx; | - | ||||||||||||||||||||||||||||||
| 1967 | d->glUseProgram(0); | - | ||||||||||||||||||||||||||||||
| 1968 | d->transferMode(BrushDrawingMode); | - | ||||||||||||||||||||||||||||||
| 1969 | d->device->endPaint(); | - | ||||||||||||||||||||||||||||||
| 1970 | - | |||||||||||||||||||||||||||||||
| 1971 | ctx->d_ptr->active_engine = 0; | - | ||||||||||||||||||||||||||||||
| 1972 | - | |||||||||||||||||||||||||||||||
| 1973 | d->resetOpenGLContextActiveEngine(); | - | ||||||||||||||||||||||||||||||
| 1974 | - | |||||||||||||||||||||||||||||||
| 1975 | d->resetGLState(); | - | ||||||||||||||||||||||||||||||
| 1976 | - | |||||||||||||||||||||||||||||||
| 1977 | delete d->shaderManager; | - | ||||||||||||||||||||||||||||||
| 1978 | d->shaderManager = 0; | - | ||||||||||||||||||||||||||||||
| 1979 | d->currentBrush = QBrush(); | - | ||||||||||||||||||||||||||||||
| 1980 | return executed 3 times by 1 test: false;return false;Executed by:
executed 3 times by 1 test: return false;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 1981 | } | - | ||||||||||||||||||||||||||||||
| 1982 | - | |||||||||||||||||||||||||||||||
| 1983 | void QGL2PaintEngineEx::ensureActive() | - | ||||||||||||||||||||||||||||||
| 1984 | { | - | ||||||||||||||||||||||||||||||
| 1985 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1986 | QGLContext *ctx = d->ctx; | - | ||||||||||||||||||||||||||||||
| 1987 | - | |||||||||||||||||||||||||||||||
| 1988 | if (isActive()
| 0-42 | ||||||||||||||||||||||||||||||
| 1989 | ctx->d_ptr->active_engine = this; | - | ||||||||||||||||||||||||||||||
| 1990 | d->needsSync = true; | - | ||||||||||||||||||||||||||||||
| 1991 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1992 | - | |||||||||||||||||||||||||||||||
| 1993 | d->device->ensureActiveTarget(); | - | ||||||||||||||||||||||||||||||
| 1994 | - | |||||||||||||||||||||||||||||||
| 1995 | if (d->needsSync
| 3-39 | ||||||||||||||||||||||||||||||
| 1996 | d->transferMode(BrushDrawingMode); | - | ||||||||||||||||||||||||||||||
| 1997 | d->glViewport(0, 0, d->width, d->height); | - | ||||||||||||||||||||||||||||||
| 1998 | d->needsSync = false; | - | ||||||||||||||||||||||||||||||
| 1999 | d->lastMaskTextureUsed = 0; | - | ||||||||||||||||||||||||||||||
| 2000 | d->shaderManager->setDirty(); | - | ||||||||||||||||||||||||||||||
| 2001 | d->ctx->d_func()->syncGlState(); | - | ||||||||||||||||||||||||||||||
| 2002 | for (int i = 0; i < 3
| 3-9 | ||||||||||||||||||||||||||||||
| 2003 | d->vertexAttribPointers[i] = (GLfloat*)-1; executed 9 times by 1 test: d->vertexAttribPointers[i] = (GLfloat*)-1;Executed by:
| 9 | ||||||||||||||||||||||||||||||
| 2004 | setState(state()); | - | ||||||||||||||||||||||||||||||
| 2005 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2006 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||||||||
| 2007 | - | |||||||||||||||||||||||||||||||
| 2008 | void QGL2PaintEngineExPrivate::updateClipScissorTest() | - | ||||||||||||||||||||||||||||||
| 2009 | { | - | ||||||||||||||||||||||||||||||
| 2010 | QGL2PaintEngineEx * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2011 | if (q->state()->clipTestEnabled
| 0-3 | ||||||||||||||||||||||||||||||
| 2012 | glEnable(0x0B90); | - | ||||||||||||||||||||||||||||||
| 2013 | glStencilFunc(0x0203, q->state()->currentClip, ~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 2014 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2015 | glDisable(0x0B90); | - | ||||||||||||||||||||||||||||||
| 2016 | glStencilFunc(0x0207, 0, 0xff); | - | ||||||||||||||||||||||||||||||
| 2017 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2018 | - | |||||||||||||||||||||||||||||||
| 2019 | - | |||||||||||||||||||||||||||||||
| 2020 | - | |||||||||||||||||||||||||||||||
| 2021 | - | |||||||||||||||||||||||||||||||
| 2022 | QRect bounds = q->state()->rectangleClip; | - | ||||||||||||||||||||||||||||||
| 2023 | if (!q->state()->clipEnabled
| 0-3 | ||||||||||||||||||||||||||||||
| 2024 | if (useSystemClip
| 0 | ||||||||||||||||||||||||||||||
| 2025 | bounds = systemClip.boundingRect(); never executed: bounds = systemClip.boundingRect(); | 0 | ||||||||||||||||||||||||||||||
| 2026 | else | - | ||||||||||||||||||||||||||||||
| 2027 | bounds = QRect(0, 0, width, height); never executed: bounds = QRect(0, 0, width, height); | 0 | ||||||||||||||||||||||||||||||
| 2028 | } else { | - | ||||||||||||||||||||||||||||||
| 2029 | if (useSystemClip
| 0-3 | ||||||||||||||||||||||||||||||
| 2030 | bounds = bounds.intersected(systemClip.boundingRect()); executed 3 times by 1 test: bounds = bounds.intersected(systemClip.boundingRect());Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2031 | else | - | ||||||||||||||||||||||||||||||
| 2032 | bounds = bounds.intersected(QRect(0, 0, width, height)); never executed: bounds = bounds.intersected(QRect(0, 0, width, height)); | 0 | ||||||||||||||||||||||||||||||
| 2033 | } | - | ||||||||||||||||||||||||||||||
| 2034 | - | |||||||||||||||||||||||||||||||
| 2035 | currentScissorBounds = bounds; | - | ||||||||||||||||||||||||||||||
| 2036 | - | |||||||||||||||||||||||||||||||
| 2037 | if (bounds == QRect(0, 0, width, height)
| 1-2 | ||||||||||||||||||||||||||||||
| 2038 | glDisable(0x0C11); | - | ||||||||||||||||||||||||||||||
| 2039 | } executed 1 time by 1 test: else {end of blockExecuted by:
| 1 | ||||||||||||||||||||||||||||||
| 2040 | glEnable(0x0C11); | - | ||||||||||||||||||||||||||||||
| 2041 | setScissor(bounds); | - | ||||||||||||||||||||||||||||||
| 2042 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 2043 | - | |||||||||||||||||||||||||||||||
| 2044 | } | - | ||||||||||||||||||||||||||||||
| 2045 | - | |||||||||||||||||||||||||||||||
| 2046 | void QGL2PaintEngineExPrivate::setScissor(const QRect &rect) | - | ||||||||||||||||||||||||||||||
| 2047 | { | - | ||||||||||||||||||||||||||||||
| 2048 | const int left = rect.left(); | - | ||||||||||||||||||||||||||||||
| 2049 | const int width = rect.width(); | - | ||||||||||||||||||||||||||||||
| 2050 | int bottom = height - (rect.top() + rect.height()); | - | ||||||||||||||||||||||||||||||
| 2051 | if (device->isFlipped()
| 0-2 | ||||||||||||||||||||||||||||||
| 2052 | bottom = rect.top(); | - | ||||||||||||||||||||||||||||||
| 2053 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2054 | const int height = rect.height(); | - | ||||||||||||||||||||||||||||||
| 2055 | - | |||||||||||||||||||||||||||||||
| 2056 | glScissor(left, bottom, width, height); | - | ||||||||||||||||||||||||||||||
| 2057 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 2058 | - | |||||||||||||||||||||||||||||||
| 2059 | void QGL2PaintEngineEx::clipEnabledChanged() | - | ||||||||||||||||||||||||||||||
| 2060 | { | - | ||||||||||||||||||||||||||||||
| 2061 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2062 | - | |||||||||||||||||||||||||||||||
| 2063 | state()->clipChanged = true; | - | ||||||||||||||||||||||||||||||
| 2064 | - | |||||||||||||||||||||||||||||||
| 2065 | if (painter()->hasClipping()
| 0 | ||||||||||||||||||||||||||||||
| 2066 | d->regenerateClip(); never executed: d->regenerateClip(); | 0 | ||||||||||||||||||||||||||||||
| 2067 | else | - | ||||||||||||||||||||||||||||||
| 2068 | d->systemStateChanged(); never executed: d->systemStateChanged(); | 0 | ||||||||||||||||||||||||||||||
| 2069 | } | - | ||||||||||||||||||||||||||||||
| 2070 | - | |||||||||||||||||||||||||||||||
| 2071 | void QGL2PaintEngineExPrivate::clearClip(uint value) | - | ||||||||||||||||||||||||||||||
| 2072 | { | - | ||||||||||||||||||||||||||||||
| 2073 | dirtyStencilRegion -= currentScissorBounds; | - | ||||||||||||||||||||||||||||||
| 2074 | - | |||||||||||||||||||||||||||||||
| 2075 | glStencilMask(0xff); | - | ||||||||||||||||||||||||||||||
| 2076 | glClearStencil(value); | - | ||||||||||||||||||||||||||||||
| 2077 | glClear(0x00000400); | - | ||||||||||||||||||||||||||||||
| 2078 | glStencilMask(0x0); | - | ||||||||||||||||||||||||||||||
| 2079 | - | |||||||||||||||||||||||||||||||
| 2080 | q->state()->needsClipBufferClear = false; | - | ||||||||||||||||||||||||||||||
| 2081 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2082 | - | |||||||||||||||||||||||||||||||
| 2083 | void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) | - | ||||||||||||||||||||||||||||||
| 2084 | { | - | ||||||||||||||||||||||||||||||
| 2085 | transferMode(BrushDrawingMode); | - | ||||||||||||||||||||||||||||||
| 2086 | - | |||||||||||||||||||||||||||||||
| 2087 | if (snapToPixelGrid
| 0-3 | ||||||||||||||||||||||||||||||
| 2088 | snapToPixelGrid = false; | - | ||||||||||||||||||||||||||||||
| 2089 | matrixDirty = true; | - | ||||||||||||||||||||||||||||||
| 2090 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2091 | - | |||||||||||||||||||||||||||||||
| 2092 | if (matrixDirty
| 0-3 | ||||||||||||||||||||||||||||||
| 2093 | updateMatrix(); executed 3 times by 1 test: updateMatrix();Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2094 | - | |||||||||||||||||||||||||||||||
| 2095 | stencilClean = false; | - | ||||||||||||||||||||||||||||||
| 2096 | - | |||||||||||||||||||||||||||||||
| 2097 | const bool singlePass = !path.hasWindingFill()
| 0-3 | ||||||||||||||||||||||||||||||
| 2098 | && (((
| 0-3 | ||||||||||||||||||||||||||||||
| 2099 | || q->state()->needsClipBufferClear
| 0-3 | ||||||||||||||||||||||||||||||
| 2100 | const uint referenceClipValue = q->state()->needsClipBufferClear
| 0-3 | ||||||||||||||||||||||||||||||
| 2101 | - | |||||||||||||||||||||||||||||||
| 2102 | if (q->state()->needsClipBufferClear
| 0-3 | ||||||||||||||||||||||||||||||
| 2103 | clearClip(1); never executed: clearClip(1); | 0 | ||||||||||||||||||||||||||||||
| 2104 | - | |||||||||||||||||||||||||||||||
| 2105 | if (path.isEmpty()
| 0-3 | ||||||||||||||||||||||||||||||
| 2106 | glEnable(0x0B90); | - | ||||||||||||||||||||||||||||||
| 2107 | glStencilFunc(0x0203, value, ~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 2108 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2109 | } | - | ||||||||||||||||||||||||||||||
| 2110 | - | |||||||||||||||||||||||||||||||
| 2111 | if (q->state()->clipTestEnabled
| 0-3 | ||||||||||||||||||||||||||||||
| 2112 | glStencilFunc(0x0203, q->state()->currentClip, ~GLuint(0x80)); never executed: glStencilFunc(0x0203, q->state()->currentClip, ~GLuint(0x80)); | 0 | ||||||||||||||||||||||||||||||
| 2113 | else | - | ||||||||||||||||||||||||||||||
| 2114 | glStencilFunc(0x0207, 0, 0xff); executed 3 times by 1 test: glStencilFunc(0x0207, 0, 0xff);Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2115 | - | |||||||||||||||||||||||||||||||
| 2116 | vertexCoordinateArray.clear(); | - | ||||||||||||||||||||||||||||||
| 2117 | vertexCoordinateArray.addPath(path, inverseScale, false); | - | ||||||||||||||||||||||||||||||
| 2118 | - | |||||||||||||||||||||||||||||||
| 2119 | if (!singlePass
| 0-3 | ||||||||||||||||||||||||||||||
| 2120 | fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); executed 3 times by 1 test: fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill());Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2121 | - | |||||||||||||||||||||||||||||||
| 2122 | glColorMask(false, false, false, false); | - | ||||||||||||||||||||||||||||||
| 2123 | glEnable(0x0B90); | - | ||||||||||||||||||||||||||||||
| 2124 | useSimpleShader(); | - | ||||||||||||||||||||||||||||||
| 2125 | - | |||||||||||||||||||||||||||||||
| 2126 | if (singlePass
| 0-3 | ||||||||||||||||||||||||||||||
| 2127 | - | |||||||||||||||||||||||||||||||
| 2128 | - | |||||||||||||||||||||||||||||||
| 2129 | - | |||||||||||||||||||||||||||||||
| 2130 | glStencilFunc(0x0203, referenceClipValue, ~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 2131 | glStencilOp(0x1E00, 0x150A, 0x150A); | - | ||||||||||||||||||||||||||||||
| 2132 | glStencilMask(value ^ referenceClipValue); | - | ||||||||||||||||||||||||||||||
| 2133 | - | |||||||||||||||||||||||||||||||
| 2134 | drawVertexArrays(vertexCoordinateArray, 0x0006); | - | ||||||||||||||||||||||||||||||
| 2135 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2136 | glStencilOp(0x1E00, 0x1E01, 0x1E01); | - | ||||||||||||||||||||||||||||||
| 2137 | glStencilMask(0xff); | - | ||||||||||||||||||||||||||||||
| 2138 | - | |||||||||||||||||||||||||||||||
| 2139 | if (!q->state()->clipTestEnabled
| 0-3 | ||||||||||||||||||||||||||||||
| 2140 | - | |||||||||||||||||||||||||||||||
| 2141 | glStencilFunc(0x0205, GLuint(0x80), ~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 2142 | composite(vertexCoordinateArray.boundingRect()); | - | ||||||||||||||||||||||||||||||
| 2143 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2144 | - | |||||||||||||||||||||||||||||||
| 2145 | - | |||||||||||||||||||||||||||||||
| 2146 | glStencilFunc(0x0205, value, GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 2147 | - | |||||||||||||||||||||||||||||||
| 2148 | composite(vertexCoordinateArray.boundingRect()); | - | ||||||||||||||||||||||||||||||
| 2149 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2150 | - | |||||||||||||||||||||||||||||||
| 2151 | glStencilFunc(0x0203, value, ~GLuint(0x80)); | - | ||||||||||||||||||||||||||||||
| 2152 | glStencilMask(0); | - | ||||||||||||||||||||||||||||||
| 2153 | - | |||||||||||||||||||||||||||||||
| 2154 | glColorMask(true, true, true, true); | - | ||||||||||||||||||||||||||||||
| 2155 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2156 | - | |||||||||||||||||||||||||||||||
| 2157 | void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) | - | ||||||||||||||||||||||||||||||
| 2158 | { | - | ||||||||||||||||||||||||||||||
| 2159 | - | |||||||||||||||||||||||||||||||
| 2160 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2161 | - | |||||||||||||||||||||||||||||||
| 2162 | state()->clipChanged = true; | - | ||||||||||||||||||||||||||||||
| 2163 | - | |||||||||||||||||||||||||||||||
| 2164 | ensureActive(); | - | ||||||||||||||||||||||||||||||
| 2165 | - | |||||||||||||||||||||||||||||||
| 2166 | if (op == Qt::ReplaceClip
| 0 | ||||||||||||||||||||||||||||||
| 2167 | op = Qt::IntersectClip; | - | ||||||||||||||||||||||||||||||
| 2168 | if (d->hasClipOperations()
| 0 | ||||||||||||||||||||||||||||||
| 2169 | d->systemStateChanged(); | - | ||||||||||||||||||||||||||||||
| 2170 | state()->canRestoreClip = false; | - | ||||||||||||||||||||||||||||||
| 2171 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2172 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2173 | - | |||||||||||||||||||||||||||||||
| 2174 | - | |||||||||||||||||||||||||||||||
| 2175 | if (!path.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2176 | const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); | - | ||||||||||||||||||||||||||||||
| 2177 | QRectF rect(points[0], points[2]); | - | ||||||||||||||||||||||||||||||
| 2178 | - | |||||||||||||||||||||||||||||||
| 2179 | if (state()->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 2180 | || (state()->matrix.type() == QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 2181 | && qFuzzyIsNull(state()->matrix.m11())
| 0 | ||||||||||||||||||||||||||||||
| 2182 | && qFuzzyIsNull(state()->matrix.m22())
| 0 | ||||||||||||||||||||||||||||||
| 2183 | { | - | ||||||||||||||||||||||||||||||
| 2184 | state()->rectangleClip = state()->rectangleClip.intersected(state()->matrix.mapRect(rect).toRect()); | - | ||||||||||||||||||||||||||||||
| 2185 | d->updateClipScissorTest(); | - | ||||||||||||||||||||||||||||||
| 2186 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2187 | } | - | ||||||||||||||||||||||||||||||
| 2188 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2189 | - | |||||||||||||||||||||||||||||||
| 2190 | - | |||||||||||||||||||||||||||||||
| 2191 | const QRect pathRect = state()->matrix.mapRect(path.controlPointRect()).toAlignedRect(); | - | ||||||||||||||||||||||||||||||
| 2192 | - | |||||||||||||||||||||||||||||||
| 2193 | switch (op) { | - | ||||||||||||||||||||||||||||||
| 2194 | case never executed: Qt::NoClip:case Qt::NoClip:never executed: case Qt::NoClip: | 0 | ||||||||||||||||||||||||||||||
| 2195 | if (d->useSystemClip
| 0 | ||||||||||||||||||||||||||||||
| 2196 | state()->clipTestEnabled = true; | - | ||||||||||||||||||||||||||||||
| 2197 | state()->currentClip = 1; | - | ||||||||||||||||||||||||||||||
| 2198 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2199 | state()->clipTestEnabled = false; | - | ||||||||||||||||||||||||||||||
| 2200 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2201 | state()->rectangleClip = QRect(0, 0, d->width, d->height); | - | ||||||||||||||||||||||||||||||
| 2202 | state()->canRestoreClip = false; | - | ||||||||||||||||||||||||||||||
| 2203 | d->updateClipScissorTest(); | - | ||||||||||||||||||||||||||||||
| 2204 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2205 | case never executed: Qt::IntersectClip:case Qt::IntersectClip:never executed: case Qt::IntersectClip: | 0 | ||||||||||||||||||||||||||||||
| 2206 | state()->rectangleClip = state()->rectangleClip.intersected(pathRect); | - | ||||||||||||||||||||||||||||||
| 2207 | d->updateClipScissorTest(); | - | ||||||||||||||||||||||||||||||
| 2208 | d->resetClipIfNeeded(); | - | ||||||||||||||||||||||||||||||
| 2209 | ++d->maxClip; | - | ||||||||||||||||||||||||||||||
| 2210 | d->writeClip(path, d->maxClip); | - | ||||||||||||||||||||||||||||||
| 2211 | state()->currentClip = d->maxClip; | - | ||||||||||||||||||||||||||||||
| 2212 | state()->clipTestEnabled = true; | - | ||||||||||||||||||||||||||||||
| 2213 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2214 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2215 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2216 | } | - | ||||||||||||||||||||||||||||||
| 2217 | } | - | ||||||||||||||||||||||||||||||
| 2218 | - | |||||||||||||||||||||||||||||||
| 2219 | void QGL2PaintEngineExPrivate::regenerateClip() | - | ||||||||||||||||||||||||||||||
| 2220 | { | - | ||||||||||||||||||||||||||||||
| 2221 | systemStateChanged(); | - | ||||||||||||||||||||||||||||||
| 2222 | replayClipOperations(); | - | ||||||||||||||||||||||||||||||
| 2223 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2224 | - | |||||||||||||||||||||||||||||||
| 2225 | void QGL2PaintEngineExPrivate::systemStateChanged() | - | ||||||||||||||||||||||||||||||
| 2226 | { | - | ||||||||||||||||||||||||||||||
| 2227 | QGL2PaintEngineEx * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2228 | - | |||||||||||||||||||||||||||||||
| 2229 | q->state()->clipChanged = true; | - | ||||||||||||||||||||||||||||||
| 2230 | - | |||||||||||||||||||||||||||||||
| 2231 | if (systemClip.isEmpty()
| 0-3 | ||||||||||||||||||||||||||||||
| 2232 | useSystemClip = false; | - | ||||||||||||||||||||||||||||||
| 2233 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2234 | if (q->paintDevice()->devType() == QInternal::Widget
| 0-3 | ||||||||||||||||||||||||||||||
| 2235 | QWidgetPrivate *widgetPrivate = qt_widget_private(static_cast<QWidget *>(currentClipDevice)->window()); | - | ||||||||||||||||||||||||||||||
| 2236 | useSystemClip = widgetPrivate->extra
| 0 | ||||||||||||||||||||||||||||||
| 2237 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2238 | useSystemClip = true; | - | ||||||||||||||||||||||||||||||
| 2239 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2240 | } | - | ||||||||||||||||||||||||||||||
| 2241 | - | |||||||||||||||||||||||||||||||
| 2242 | q->state()->clipTestEnabled = false; | - | ||||||||||||||||||||||||||||||
| 2243 | q->state()->needsClipBufferClear = true; | - | ||||||||||||||||||||||||||||||
| 2244 | - | |||||||||||||||||||||||||||||||
| 2245 | q->state()->currentClip = 1; | - | ||||||||||||||||||||||||||||||
| 2246 | maxClip = 1; | - | ||||||||||||||||||||||||||||||
| 2247 | - | |||||||||||||||||||||||||||||||
| 2248 | q->state()->rectangleClip = useSystemClip
| 0-3 | ||||||||||||||||||||||||||||||
| 2249 | updateClipScissorTest(); | - | ||||||||||||||||||||||||||||||
| 2250 | - | |||||||||||||||||||||||||||||||
| 2251 | if (systemClip.rectCount() == 1
| 0-3 | ||||||||||||||||||||||||||||||
| 2252 | if (systemClip.boundingRect() == QRect(0, 0, width, height)
| 0 | ||||||||||||||||||||||||||||||
| 2253 | useSystemClip = false; never executed: useSystemClip = false; | 0 | ||||||||||||||||||||||||||||||
| 2254 | - | |||||||||||||||||||||||||||||||
| 2255 | - | |||||||||||||||||||||||||||||||
| 2256 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2257 | - | |||||||||||||||||||||||||||||||
| 2258 | } | - | ||||||||||||||||||||||||||||||
| 2259 | - | |||||||||||||||||||||||||||||||
| 2260 | if (useSystemClip
| 0-3 | ||||||||||||||||||||||||||||||
| 2261 | clearClip(0); | - | ||||||||||||||||||||||||||||||
| 2262 | - | |||||||||||||||||||||||||||||||
| 2263 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
| 2264 | path.addRegion(systemClip); | - | ||||||||||||||||||||||||||||||
| 2265 | - | |||||||||||||||||||||||||||||||
| 2266 | q->state()->currentClip = 0; | - | ||||||||||||||||||||||||||||||
| 2267 | writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1); | - | ||||||||||||||||||||||||||||||
| 2268 | q->state()->currentClip = 1; | - | ||||||||||||||||||||||||||||||
| 2269 | q->state()->clipTestEnabled = true; | - | ||||||||||||||||||||||||||||||
| 2270 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2271 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2272 | - | |||||||||||||||||||||||||||||||
| 2273 | void QGL2PaintEngineEx::setTranslateZ(GLfloat z) | - | ||||||||||||||||||||||||||||||
| 2274 | { | - | ||||||||||||||||||||||||||||||
| 2275 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2276 | if (d->translateZ != z
| 0 | ||||||||||||||||||||||||||||||
| 2277 | d->translateZ = z; | - | ||||||||||||||||||||||||||||||
| 2278 | d->translateZUniformDirty = true; | - | ||||||||||||||||||||||||||||||
| 2279 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2280 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2281 | - | |||||||||||||||||||||||||||||||
| 2282 | void QGL2PaintEngineEx::setState(QPainterState *new_state) | - | ||||||||||||||||||||||||||||||
| 2283 | { | - | ||||||||||||||||||||||||||||||
| 2284 | - | |||||||||||||||||||||||||||||||
| 2285 | - | |||||||||||||||||||||||||||||||
| 2286 | QGL2PaintEngineExPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2287 | - | |||||||||||||||||||||||||||||||
| 2288 | QGL2PaintEngineState *s = static_cast<QGL2PaintEngineState *>(new_state); | - | ||||||||||||||||||||||||||||||
| 2289 | QGL2PaintEngineState *old_state = state(); | - | ||||||||||||||||||||||||||||||
| 2290 | - | |||||||||||||||||||||||||||||||
| 2291 | QPaintEngineEx::setState(s); | - | ||||||||||||||||||||||||||||||
| 2292 | - | |||||||||||||||||||||||||||||||
| 2293 | if (s->isNew
| 3 | ||||||||||||||||||||||||||||||
| 2294 | - | |||||||||||||||||||||||||||||||
| 2295 | - | |||||||||||||||||||||||||||||||
| 2296 | - | |||||||||||||||||||||||||||||||
| 2297 | s->isNew = false; | - | ||||||||||||||||||||||||||||||
| 2298 | return; executed 3 times by 1 test: return;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2299 | } | - | ||||||||||||||||||||||||||||||
| 2300 | - | |||||||||||||||||||||||||||||||
| 2301 | - | |||||||||||||||||||||||||||||||
| 2302 | - | |||||||||||||||||||||||||||||||
| 2303 | if (old_state == s
| 0-3 | ||||||||||||||||||||||||||||||
| 2304 | renderHintsChanged(); executed 3 times by 1 test: renderHintsChanged();Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2305 | - | |||||||||||||||||||||||||||||||
| 2306 | if (old_state == s
| 0-3 | ||||||||||||||||||||||||||||||
| 2307 | d->matrixDirty = true; executed 3 times by 1 test: d->matrixDirty = true;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2308 | - | |||||||||||||||||||||||||||||||
| 2309 | if (old_state == s
| 0-3 | ||||||||||||||||||||||||||||||
| 2310 | d->compositionModeDirty = true; executed 3 times by 1 test: d->compositionModeDirty = true;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2311 | - | |||||||||||||||||||||||||||||||
| 2312 | if (old_state == s
| 0-3 | ||||||||||||||||||||||||||||||
| 2313 | d->opacityUniformDirty = true; executed 3 times by 1 test: d->opacityUniformDirty = true;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2314 | - | |||||||||||||||||||||||||||||||
| 2315 | if (old_state == s
| 0-3 | ||||||||||||||||||||||||||||||
| 2316 | if (old_state
| 0-3 | ||||||||||||||||||||||||||||||
| 2317 | d->updateClipScissorTest(); | - | ||||||||||||||||||||||||||||||
| 2318 | d->glDepthFunc(0x0203); | - | ||||||||||||||||||||||||||||||
| 2319 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2320 | d->regenerateClip(); | - | ||||||||||||||||||||||||||||||
| 2321 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2322 | } | - | ||||||||||||||||||||||||||||||
| 2323 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2324 | - | |||||||||||||||||||||||||||||||
| 2325 | QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const | - | ||||||||||||||||||||||||||||||
| 2326 | { | - | ||||||||||||||||||||||||||||||
| 2327 | if (orig
| 0-3 | ||||||||||||||||||||||||||||||
| 2328 | const_cast< never executed: QGL2PaintEngineEx *>(this)->ensureActive();const_cast<QGL2PaintEngineEx *>(this)->ensureActive();never executed: const_cast<QGL2PaintEngineEx *>(this)->ensureActive(); | 0 | ||||||||||||||||||||||||||||||
| 2329 | - | |||||||||||||||||||||||||||||||
| 2330 | QGL2PaintEngineState *s; | - | ||||||||||||||||||||||||||||||
| 2331 | if (!orig
| 0-3 | ||||||||||||||||||||||||||||||
| 2332 | s = new QGL2PaintEngineState(); executed 3 times by 1 test: s = new QGL2PaintEngineState();Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2333 | else | - | ||||||||||||||||||||||||||||||
| 2334 | s = new QGL2PaintEngineState(*static_cast<QGL2PaintEngineState *>(orig)); never executed: s = new QGL2PaintEngineState(*static_cast<QGL2PaintEngineState *>(orig)); | 0 | ||||||||||||||||||||||||||||||
| 2335 | - | |||||||||||||||||||||||||||||||
| 2336 | s->matrixChanged = false; | - | ||||||||||||||||||||||||||||||
| 2337 | s->compositionModeChanged = false; | - | ||||||||||||||||||||||||||||||
| 2338 | s->opacityChanged = false; | - | ||||||||||||||||||||||||||||||
| 2339 | s->renderHintsChanged = false; | - | ||||||||||||||||||||||||||||||
| 2340 | s->clipChanged = false; | - | ||||||||||||||||||||||||||||||
| 2341 | - | |||||||||||||||||||||||||||||||
| 2342 | return executed 3 times by 1 test: s;return s;Executed by:
executed 3 times by 1 test: return s;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 2343 | } | - | ||||||||||||||||||||||||||||||
| 2344 | - | |||||||||||||||||||||||||||||||
| 2345 | QGL2PaintEngineState::QGL2PaintEngineState(QGL2PaintEngineState &other) | - | ||||||||||||||||||||||||||||||
| 2346 | : QPainterState(other) | - | ||||||||||||||||||||||||||||||
| 2347 | { | - | ||||||||||||||||||||||||||||||
| 2348 | isNew = true; | - | ||||||||||||||||||||||||||||||
| 2349 | needsClipBufferClear = other.needsClipBufferClear; | - | ||||||||||||||||||||||||||||||
| 2350 | clipTestEnabled = other.clipTestEnabled; | - | ||||||||||||||||||||||||||||||
| 2351 | currentClip = other.currentClip; | - | ||||||||||||||||||||||||||||||
| 2352 | canRestoreClip = other.canRestoreClip; | - | ||||||||||||||||||||||||||||||
| 2353 | rectangleClip = other.rectangleClip; | - | ||||||||||||||||||||||||||||||
| 2354 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2355 | - | |||||||||||||||||||||||||||||||
| 2356 | QGL2PaintEngineState::QGL2PaintEngineState() | - | ||||||||||||||||||||||||||||||
| 2357 | { | - | ||||||||||||||||||||||||||||||
| 2358 | isNew = true; | - | ||||||||||||||||||||||||||||||
| 2359 | needsClipBufferClear = true; | - | ||||||||||||||||||||||||||||||
| 2360 | clipTestEnabled = false; | - | ||||||||||||||||||||||||||||||
| 2361 | canRestoreClip = true; | - | ||||||||||||||||||||||||||||||
| 2362 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||
| 2363 | - | |||||||||||||||||||||||||||||||
| 2364 | QGL2PaintEngineState::~QGL2PaintEngineState() | - | ||||||||||||||||||||||||||||||
| 2365 | { | - | ||||||||||||||||||||||||||||||
| 2366 | } | - | ||||||||||||||||||||||||||||||
| 2367 | - | |||||||||||||||||||||||||||||||
| 2368 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |