summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine.cpp
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-11-11 09:42:05 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2010-11-11 11:50:36 (GMT)
commit8e8bae1f4faf676b6104bbf9039ad10f139fa7e8 (patch)
tree08340a0e5b3541efc86b268c3df97740b5044d10 /src/gui/text/qfontengine.cpp
parente8ddca677db9b0d3ac8ff1b2079c3b000d59d6ec (diff)
downloadQt-8e8bae1f4faf676b6104bbf9039ad10f139fa7e8.zip
Qt-8e8bae1f4faf676b6104bbf9039ad10f139fa7e8.tar.gz
Qt-8e8bae1f4faf676b6104bbf9039ad10f139fa7e8.tar.bz2
Fix for font engines that don't support subpixel positioning
Reviewed-by: aavit
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r--src/gui/text/qfontengine.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 816c14a..24c4664 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -605,12 +605,13 @@ void QFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int n
addBitmapFontToPath(x, y, g, path, flags);
}
-QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
+QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/)
{
- return alphaMapForGlyph(glyph, 0, t);
+ // For font engines don't support subpixel positioning
+ return alphaMapForGlyph(glyph);
}
-QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &t)
+QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
{
QImage i = alphaMapForGlyph(glyph);
if (t.type() > QTransform::TxTranslate)
@@ -620,6 +621,19 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/,
return i;
}
+QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
+{
+ if (! supportsSubPixelPositions())
+ return alphaMapForGlyph(glyph, t);
+
+ QImage i = alphaMapForGlyph(glyph, subPixelPosition);
+ if (t.type() > QTransform::TxTranslate)
+ i = i.transformed(t).convertToFormat(QImage::Format_Indexed8);
+ Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format...
+
+ return i;
+}
+
QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, int /* margin */, const QTransform &t)
{
QImage alphaMask = alphaMapForGlyph(glyph, t);