diff options
author | Liang QI <liang.qi@nokia.com> | 2009-09-18 14:48:24 (GMT) |
---|---|---|
committer | Liang QI <liang.qi@nokia.com> | 2009-09-18 14:48:24 (GMT) |
commit | 9446b1745196acc7a6693b4ca2ca169f51fef97b (patch) | |
tree | 096cb6847dcd9318d5656fda2482eefdd08cf3b0 /src | |
parent | d5db1f2bb5d520277f5d3ddfa5a50c385aebc753 (diff) | |
download | Qt-9446b1745196acc7a6693b4ca2ca169f51fef97b.zip Qt-9446b1745196acc7a6693b4ca2ca169f51fef97b.tar.gz Qt-9446b1745196acc7a6693b4ca2ca169f51fef97b.tar.bz2 |
Switch glyph cache from Qt to Symbian
Use Symbian glyph cache directly in QRasterPaintEngine, do not need cache them in Qt if on Symbian Platform.
Reviewed-by: Alessandro Portale
Reviewed-by: Jason Barron
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 45 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster_p.h | 4 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60_p.h | 3 |
3 files changed, 49 insertions, 3 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index f41d7b4..effc99e 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3056,7 +3056,43 @@ void QRasterPaintEngine::drawCachedGlyphs(const QPointF &p, const QTextItemInt & return; } +#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) +void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) +{ + Q_D(QRasterPaintEngine); + QRasterPaintEngineState *s = state(); + + QFontEngine *fontEngine = ti.fontEngine; + if (fontEngine->type() != QFontEngine::S60FontEngine) { + QPaintEngineEx::drawTextItem(p, ti); + return; + } + + QFontEngineS60 *fe = static_cast<QFontEngineS60 *>(fontEngine); + + QVarLengthArray<QFixedPoint> positions; + QVarLengthArray<glyph_t> glyphs; + QTransform matrix = s->matrix; + matrix.translate(p.x(), p.y()); + ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); + + const QFixed aliasDelta = QFixed::fromReal(aliasedCoordinateDelta); + + for (int i=0; i<glyphs.size(); ++i) { + TOpenFontCharMetrics tmetrics; + const TUint8 *glyphBitmapBytes; + TSize glyphBitmapSize; + fe->getCharacterData(glyphs[i], tmetrics, glyphBitmapBytes, glyphBitmapSize); + const glyph_metrics_t metrics = ti.fontEngine->boundingBox(glyphs[i]); + const int x = qFloor(positions[i].x + metrics.x + aliasDelta); + const int y = qFloor(positions[i].y + metrics.y + aliasDelta); + alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight); + } + + return; +} +#endif // Q_OS_SYMBIAN && QT_NO_FREETYPE /*! * Returns true if the rectangle is completly within the current clip @@ -3191,7 +3227,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte ensurePen(); ensureState(); -#if defined (Q_WS_WIN) || defined(Q_WS_MAC) || (defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)) +#if defined (Q_WS_WIN) || defined(Q_WS_MAC) bool drawCached = true; @@ -3224,7 +3260,12 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte return; } -#else // Q_WS_WIN || Q_WS_MAC || Q_OS_SYMBIAN && QT_NO_FREETYPE +#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_WS_WIN || Q_WS_MAC + if (s->matrix.type() <= QTransform::TxTranslate) { + drawGlyphsS60(p, ti); + return; + } +#else // Q_WS_WIN || Q_WS_MAC QFontEngine *fontEngine = ti.fontEngine; diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index fcf92cd..1787d16 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -259,6 +259,10 @@ private: void drawCachedGlyphs(const QPointF &p, const QTextItemInt &ti); +#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) + void drawGlyphsS60(const QPointF &p, const QTextItemInt &ti); +#endif // Q_OS_SYMBIAN && QT_NO_FREETYPE + inline void ensureBrush(const QBrush &brush) { if (!qbrush_fast_equals(state()->lastBrush, brush) || state()->fillFlags) updateBrush(brush); diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index dc4ff2f..44f8122 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -119,11 +119,12 @@ public: Type type() const; + void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const; + private: friend class QFontPrivate; QFixed glyphAdvance(HB_Glyph glyph) const; - void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const; CFbsBitmap *m_textRenderBitmap; CFbsBitmapDevice *m_textRenderBitmapDevice; |