diff options
author | Alessandro Portale <alessandro.portale@nokia.com> | 2010-10-12 12:00:38 (GMT) |
---|---|---|
committer | Alessandro Portale <alessandro.portale@nokia.com> | 2010-10-12 12:01:45 (GMT) |
commit | ab057be7228d20d909246183505b72e821cc440f (patch) | |
tree | 9f122c47e47c8ca0c74e4dd05ac4e780862054cd | |
parent | 61d23b1740780b3c7970c9dd5d089002a35f339e (diff) | |
download | Qt-ab057be7228d20d909246183505b72e821cc440f.zip Qt-ab057be7228d20d909246183505b72e821cc440f.tar.gz Qt-ab057be7228d20d909246183505b72e821cc440f.tar.bz2 |
Remove unnecessary calls to GetHorizBounds() + boundingBox()
QFontEngineS60::boundingBox_const(): The metrics that
CFont::getCharacterData() returns is equivalent to what
TOpenFontCharMetrics::GetHorizBounds() returns. So, remove
the use of TRect glyphBounds, and
TOpenFontCharMetrics::GetHorizBounds().
Implementation of TOpenFontCharMetrics::GetHorizBounds():
http://developer.symbian.org/oss/API_REF/Public_API/file/837f303aceeb/epoc32/include/openfont.h#l1352
QRasterPaintEngine::drawGlyphsS60(): The metrics that
QFontEngineS60::getCharacterData() returns are equivalent to
what QFontEngineS60::boundingBox() returns. So, remove the
use of glyph_metrics_t metrics, and QFontEngineS60::boundingBox().
These changes increase the Fps in
qt\tests\manual\textrendering\textperformance "Latin" from 16.2 to
16.5 Fps on an XM5800. And they do that by removing code :)
Task-number: QTBUG-14378
Reviewed-by: Jason Barron
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 10 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 9749244..c92d291 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3164,10 +3164,8 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) 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); - + const int x = qFloor(positions[i].x + tmetrics.HorizBearingX() + aliasDelta); + const int y = qFloor(positions[i].y - tmetrics.HorizBearingY() + aliasDelta); alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight); } diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 653965e..32fcb82 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -360,13 +360,11 @@ glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const const TUint8 *glyphBitmapBytes; TSize glyphBitmapSize; getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize); - TRect glyphBounds; - metrics.GetHorizBounds(glyphBounds); const glyph_metrics_t result( - glyphBounds.iTl.iX, - glyphBounds.iTl.iY, - glyphBounds.Width(), - glyphBounds.Height(), + metrics.HorizBearingX(), + -metrics.HorizBearingY(), + metrics.Width(), + metrics.Height(), metrics.HorizAdvance(), 0 ); |