diff options
author | Alessandro Portale <alessandro.portale@nokia.com> | 2010-10-12 20:55:20 (GMT) |
---|---|---|
committer | Alessandro Portale <alessandro.portale@nokia.com> | 2010-10-12 20:55:20 (GMT) |
commit | 7d21b598d299ee61d61f15c69b41b8b38daf9bea (patch) | |
tree | 8712b68eb901921c741a1320bf751119315db050 /src | |
parent | 0c1e85db7e810e5ac7496dd5fb4c0bd37746be11 (diff) | |
download | Qt-7d21b598d299ee61d61f15c69b41b8b38daf9bea.zip Qt-7d21b598d299ee61d61f15c69b41b8b38daf9bea.tar.gz Qt-7d21b598d299ee61d61f15c69b41b8b38daf9bea.tar.bz2 |
Remove obsolete tweak in QFontEngineS60::alphaMapForGlyph
On some Symbian versions (apparently <= Symbian^1),
CFont::GetCharacterData() returns 8-bit data with gray values
0x00, 0x10 ... 0xe0, 0xf0 due to a bug. The glyphs are nowhere
perfectly opaque, which is bad for blitting.
This has been however been fixed for Symbian^3.
The funny thing about this tweak was that it was only executed
on Symbian^3 (with the OpenVG/OpenGL paintengines). On Symbian^1
and below (rasterpaintengine), QFontEngineS60::alphaMapForGlyph()
does not get called at all, anymore.
Therefore, the removal of this tweak should not be noticable
anywhere, except that on Symbian^3, quite a few CPU cycles are
now saved.
See the attachments in QTBUG-14419 for details.
Task-Number: QTBUG-14419
Reviewed-By: TrustMe
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 3705136..bf30e1c 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -345,29 +345,17 @@ void QFontEngineS60::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph) { + // Note: On some Symbian versions (apparently <= Symbian^1), this + // function will return gray values 0x00, 0x10 ... 0xe0, 0xf0 due + // to a bug. The glyphs are nowhere perfectly opaque. + // This has been fixed for Symbian^3. + TOpenFontCharMetrics metrics; const TUint8 *glyphBitmapBytes; TSize glyphBitmapSize; getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize); QImage result(glyphBitmapBytes, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight, glyphBitmapSize.iWidth, QImage::Format_Indexed8); result.setColorTable(grayPalette()); - - // The above setColorTable() call detached the image data anyway, so why not shape tha data a bit, while we can. - // CFont::GetCharacterData() returns 8-bit data that obviously was 4-bit data before, and converted to 8-bit incorrectly. - // The data values are 0x00, 0x10 ... 0xe0, 0xf0. So, a real opaque 0xff is never reached, which we get punished - // for every time we want to blit this glyph in the raster paint engine. - // "Fix" is to convert all 0xf0 to 0xff. Is fine, quality wise, and I assume faster than correcting all values. - // Blitting is however, evidentially faster now. - const int bpl = result.bytesPerLine(); - for (int row = 0; row < result.height(); ++row) { - uchar *scanLine = result.scanLine(row); - for (int column = 0; column < bpl; ++column) { - if (*scanLine == 0xf0) - *scanLine = 0xff; - scanLine++; - } - } - return result; } |