diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-05-30 09:39:18 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-05-30 10:09:49 (GMT) |
commit | 48ff7e5af99923396243940979d15d4ec2e2730c (patch) | |
tree | f2859fee83ec913bce182fd1b20e4fe603b13f80 /src | |
parent | f370dd07560c449ba17d13475721f7d3b46e6b24 (diff) | |
download | Qt-48ff7e5af99923396243940979d15d4ec2e2730c.zip Qt-48ff7e5af99923396243940979d15d4ec2e2730c.tar.gz Qt-48ff7e5af99923396243940979d15d4ec2e2730c.tar.bz2 |
Missing glyphs transforming QStaticText on X11/raster with subpixel AA
Static text took an untested and broken code path for the combo of
subpixel AA, X11, raster engine and transformation. This would cause
missing glyphs. The reason was that QStaticText took an unused code path
which turned out not to work. The workaround is to use gray AA on
transformed text, like we already do for the GL engine. In Qt 4.8, the
static text code path has been rewritten to use the Freetype cache
instead of the image glyph cache, so the bug will be fixed more properly
there.
Reviewed-by: Samuel
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 01b22da..cd9206c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3105,7 +3105,15 @@ void QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); - QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) : d->glyphCacheType; + QFontEngineGlyphCache::Type glyphType; + if (fontEngine->glyphFormat >= 0) { + glyphType = QFontEngineGlyphCache::Type(fontEngine->glyphFormat); + } else if (s->matrix.type() > QTransform::TxTranslate + && d->glyphCacheType == QFontEngineGlyphCache::Raster_RGBMask) { + glyphType = QFontEngineGlyphCache::Raster_A8; + } else { + glyphType = d->glyphCacheType; + } QImageTextureGlyphCache *cache = static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphType, s->matrix)); diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 16df6c1..2c1da24 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -178,14 +178,10 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g) const { #if defined(Q_WS_X11) - if (m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { + if (m_type != Raster_RGBMask && m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { QFontEngineFT::GlyphFormat format = QFontEngineFT::Format_None; QImage::Format imageFormat = QImage::Format_Invalid; switch (m_type) { - case Raster_RGBMask: - format = QFontEngineFT::Format_A32; - imageFormat = QImage::Format_RGB32; - break; case Raster_A8: format = QFontEngineFT::Format_A8; imageFormat = QImage::Format_Indexed8; @@ -266,7 +262,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g) } #endif - if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()), qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(), m_image.format()); |