From 76e56fc449749909ead292f632fb7965cfa9ae78 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 16 Sep 2011 14:16:44 +0200 Subject: [PATCH] Enable glyph caching on QPA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The glyph caching was disabled on QPA, possibly due to some bugs which have gone away now. To avoid the performance hit of this, we need to enable it. Simple tests of QTextEdit indicate that this works fine. Change-Id: I40845b327331b366161f1ca55bf00853bca87358 Reviewed-on: http://codereview.qt-project.org/5096 Reviewed-by: Qt Sanity Bot Reviewed-by: Samuel Rødal --- src/gui/painting/qpaintengine_raster.cpp | 34 +++--------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4d4b88b229..62701eb569 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3031,7 +3031,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte ensurePen(); ensureState(); -#if defined (Q_WS_WIN) || defined(Q_WS_MAC) +#if defined (Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_QPA) if (!supportsTransformations(ti.fontEngine)) { QVarLengthArray positions; @@ -3046,45 +3046,17 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte return; } -#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_OS_WIN || Q_WS_MAC +#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_OS_WIN || Q_WS_MAC || Q_WS_QPA if (s->matrix.type() <= QTransform::TxTranslate || (s->matrix.type() == QTransform::TxScale && (qFuzzyCompare(s->matrix.m11(), s->matrix.m22())))) { drawGlyphsS60(p, ti); return; } -#else // Q_OS_WIN || Q_WS_MAC +#else // Q_OS_WIN || Q_WS_MAC || Q_WS_QPA QFontEngine *fontEngine = ti.fontEngine; -#ifdef Q_WS_QPA - if (s->matrix.type() < QTransform::TxScale) { - - QVarLengthArray positions; - QVarLengthArray glyphs; - QTransform matrix = state()->transform(); - - qreal _x = qFloor(p.x()); - qreal _y = qFloor(p.y()); - matrix.translate(_x, _y); - - fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); - if (glyphs.size() == 0) - return; - - for(int i = 0; i < glyphs.size(); i++) { - QImage img = fontEngine->alphaMapForGlyph(glyphs[i]); - glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[i]); - // ### hm, perhaps an QFixed offs = QFixed::fromReal(aliasedCoordinateDelta) is needed here? - alphaPenBlt(img.bits(), img.bytesPerLine(), img.depth(), - qRound(positions[i].x + metrics.x), - qRound(positions[i].y + metrics.y), - img.width(), img.height()); - } - return; - } -#endif //Q_WS_QPA - #if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) if (fontEngine->type() != QFontEngine::Freetype) {