diff options
Diffstat (limited to 'src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 32dd7be7ba..ec4ff5a2b2 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1482,20 +1482,20 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) // don't try to cache huge fonts or vastly transformed fonts QFontEngine *fontEngine = textItem->fontEngine(); if (shouldDrawCachedGlyphs(fontEngine, s->matrix)) { - QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 - ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat) - : d->glyphCacheType; - if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { + QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat >= 0 + ? QFontEngine::GlyphFormat(textItem->fontEngine()->glyphFormat) + : d->glyphCacheFormat; + if (glyphFormat == QFontEngine::Format_A32) { if (!QGLFramebufferObject::hasOpenGLFramebufferObjects() || d->device->alphaRequested() || s->matrix.type() > QTransform::TxTranslate || (s->composition_mode != QPainter::CompositionMode_Source && s->composition_mode != QPainter::CompositionMode_SourceOver)) { - glyphType = QFontEngineGlyphCache::Raster_A8; + glyphFormat = QFontEngine::Format_A8; } } - d->drawCachedGlyphs(glyphType, textItem); + d->drawCachedGlyphs(glyphFormat, textItem); } else { QPaintEngineEx::drawStaticTextItem(textItem); } @@ -1532,18 +1532,18 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem QTransform::TransformationType txtype = s->matrix.type(); - QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 - ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) - : d->glyphCacheType; + QFontEngine::GlyphFormat glyphFormat = ti.fontEngine->glyphFormat >= 0 + ? ti.fontEngine->glyphFormat + : d->glyphCacheFormat; - if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { + if (glyphFormat == QFontEngine::Format_A32) { if (!QGLFramebufferObject::hasOpenGLFramebufferObjects() || d->device->alphaRequested() || txtype > QTransform::TxTranslate || (state()->composition_mode != QPainter::CompositionMode_Source && state()->composition_mode != QPainter::CompositionMode_SourceOver)) { - glyphType = QFontEngineGlyphCache::Raster_A8; + glyphFormat = QFontEngine::Format_A8; } } @@ -1562,7 +1562,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem staticTextItem.numGlyphs = glyphs.size(); staticTextItem.glyphPositions = positions.data(); - d->drawCachedGlyphs(glyphType, &staticTextItem); + d->drawCachedGlyphs(glyphFormat, &staticTextItem); } return; } @@ -1587,7 +1587,7 @@ namespace { QSize cacheSize; QGL2PEXVertexArray vertexCoordinateArray; QGL2PEXVertexArray textureCoordinateArray; - QFontEngineGlyphCache::Type glyphType; + QFontEngine::GlyphFormat glyphFormat; int cacheSerialNumber; }; @@ -1596,7 +1596,7 @@ namespace { // #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO -void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, +void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat, QStaticTextItem *staticTextItem) { Q_Q(QGL2PaintEngineEx); @@ -1620,9 +1620,9 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp } QGLTextureGlyphCache *cache = - (QGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphType, glyphCacheTransform); - if (!cache || cache->cacheType() != glyphType || cache->contextGroup() == 0) { - cache = new QGLTextureGlyphCache(glyphType, glyphCacheTransform); + (QGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphFormat, glyphCacheTransform); + if (!cache || cache->glyphFormat() != glyphFormat || cache->contextGroup() == 0) { + cache = new QGLTextureGlyphCache(glyphFormat, glyphCacheTransform); fe->setGlyphCache(cacheKey, cache); recreateVertexArrays = true; } @@ -1635,7 +1635,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp recreateVertexArrays = true; } else { QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData()); - if (userData->glyphType != glyphType) { + if (userData->glyphFormat != glyphFormat) { recreateVertexArrays = true; } else if (userData->cacheSerialNumber != cache->serialNumber()) { recreateVertexArrays = true; @@ -1662,7 +1662,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp transferMode(TextDrawingMode); - int margin = fe->glyphMargin(glyphType); + int margin = fe->glyphMargin(glyphFormat); GLfloat dx = 1.0 / cache->width(); GLfloat dy = 1.0 / cache->height(); @@ -1684,7 +1684,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData()); } - userData->glyphType = glyphType; + userData->glyphFormat = glyphFormat; userData->cacheSerialNumber = cache->serialNumber(); // Use cache if backend optimizations is turned on @@ -1767,7 +1767,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp QBrush pensBrush = q->state()->pen.brush(); setBrush(pensBrush); - if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { + if (glyphFormat == QFontEngine::Format_A32) { // Subpixel antialiasing without gamma correction @@ -2037,11 +2037,11 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) glDisable(GL_MULTISAMPLE); #endif - d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; + d->glyphCacheFormat = QFontEngine::Format_A8; #if !defined(QT_OPENGL_ES_2) if (!QOpenGLFunctions::isES()) { - d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; + d->glyphCacheFormat = QFontEngine::Format_A32; d->multisamplingAlwaysEnabled = false; } else { d->multisamplingAlwaysEnabled = d->device->format().sampleBuffers(); |