summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-09-16 10:55:12 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-09-21 14:37:47 (GMT)
commit01383e6fde102ebeff5f87a90142c6d1cdb44d94 (patch)
tree251c00cb900517b0012b5a2780e38885c7316745 /src/gui
parent65b4ce3c51283adb76dcb73cc654b06359b1ae00 (diff)
downloadQt-01383e6fde102ebeff5f87a90142c6d1cdb44d94.zip
Qt-01383e6fde102ebeff5f87a90142c6d1cdb44d94.tar.gz
Qt-01383e6fde102ebeff5f87a90142c6d1cdb44d94.tar.bz2
Made subpixel antialiasing in the GL2 engine work on X11 as well.
Need to add alphaRGBMapForGlyph to the Freetype font engine. Reviewed-by: Kim
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qfontengine_ft.cpp22
-rw-r--r--src/gui/text/qfontengine_ft_p.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 49149c5..a4b2e7e 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1848,6 +1848,28 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g)
return img;
}
+QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, int margin, const QTransform &t)
+{
+ if (t.type() != QTransform::TxTranslate)
+ return QFontEngine::alphaRGBMapForGlyph(g, margin, t);
+
+ lockFace();
+
+ GlyphFormat glyph_format = Format_A32;
+
+ Glyph *glyph = defaultGlyphSet.outline_drawing ? 0 : loadGlyph(g, glyph_format);
+ if (!glyph) {
+ unlockFace();
+ return QFontEngine::alphaRGBMapForGlyph(g, margin, t);
+ }
+
+ QImage img(glyph->width, glyph->height, QImage::Format_RGB32);
+ memcpy(img.bits(), glyph->data, 4 * glyph->width * glyph->height);
+ unlockFace();
+
+ return img;
+}
+
void QFontEngineFT::removeGlyphFromCache(glyph_t glyph)
{
delete defaultGlyphSet.glyph_data.take(glyph);
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index 6704c8f..99b40f8 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -227,6 +227,7 @@ public:
virtual void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const;
virtual QImage alphaMapForGlyph(glyph_t);
+ virtual QImage alphaRGBMapForGlyph(glyph_t, int margin, const QTransform &t);
virtual void removeGlyphFromCache(glyph_t glyph);
virtual int glyphCount() const;