diff options
Diffstat (limited to 'src/gui/opengl/qopenglpaintengine.cpp')
-rw-r--r-- | src/gui/opengl/qopenglpaintengine.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 624eeaffd9..6238564eeb 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1407,11 +1407,9 @@ void QOpenGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) ensureActive(); QPainterState *s = state(); - float det = s->matrix.determinant(); - // don't try to cache huge fonts or vastly transformed fonts QFontEngine *fontEngine = textItem->fontEngine(); - if (shouldDrawCachedGlyphs(fontEngine, s->matrix) && det >= 0.25f && det <= 4.f) { + if (shouldDrawCachedGlyphs(fontEngine, s->matrix)) { QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat) : d->glyphCacheType; @@ -1461,13 +1459,6 @@ void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &text QTransform::TransformationType txtype = s->matrix.type(); - float det = s->matrix.determinant(); - bool drawCached = txtype < QTransform::TxProject; - - // don't try to cache huge fonts or vastly transformed fonts - if (!shouldDrawCachedGlyphs(ti.fontEngine, s->matrix) || det < 0.25f || det > 4.f) - drawCached = false; - QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) : d->glyphCacheType; @@ -1482,7 +1473,7 @@ void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &text } } - if (drawCached) { + if (shouldDrawCachedGlyphs(ti.fontEngine, s->matrix)) { QVarLengthArray<QFixedPoint> positions; QVarLengthArray<glyph_t> glyphs; QTransform matrix = QTransform::fromTranslate(p.x(), p.y()); @@ -1531,6 +1522,16 @@ namespace { // #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO +bool QOpenGL2PaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &t) const +{ + float det = t.determinant(); + + // Don't try to cache huge fonts or vastly transformed fonts + return t.type() < QTransform::TxProject + && QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t) + && det >= 0.25f && det <= 4.f; +} + void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem) { |