From 0b7beaaaf2384fae01ae403737450a59b2fcabac Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 12 Mar 2014 17:32:48 +0100 Subject: Fix rendering of grayscale antialiased FT fonts on QGLWidget QFontEngineFT::alphaMapForGlyph and QFontEngineFT::alphaRGBMapForGlyph has been broken since change#65694. They always fall back to using the path rendering of QFontEngine because we zero the scoped pointer just before testing it. To fix it we need to release the scope pointer after we are done using it. Change-Id: I8811c1f5261f286f2f3dd3c0f93c988ba0909669 Reviewed-by: Konstantin Ritt --- src/gui/text/qfontengine_ft.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 11e9ce6c02..fe38755ffd 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1934,8 +1934,6 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition) lockFace(); QScopedPointer glyph(loadGlyphFor(g, subPixelPosition, antialias ? Format_A8 : Format_Mono)); - if (cacheEnabled) - glyph.take(); if (!glyph || !glyph->data) { unlockFace(); return QFontEngine::alphaMapForGlyph(g); @@ -1960,6 +1958,8 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition) for (int y = 0; y < glyph->height; ++y) memcpy(img.scanLine(y), &glyph->data[y * pitch], pitch); } + if (cacheEnabled) + glyph.take(); unlockFace(); return img; @@ -1973,8 +1973,6 @@ QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, co lockFace(); QScopedPointer glyph(loadGlyphFor(g, subPixelPosition, Format_A32)); - if (cacheEnabled) - glyph.take(); if (!glyph || !glyph->data) { unlockFace(); return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t); @@ -1982,6 +1980,9 @@ QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, co QImage img(glyph->width, glyph->height, QImage::Format_RGB32); memcpy(img.bits(), glyph->data, 4 * glyph->width * glyph->height); + + if (cacheEnabled) + glyph.take(); unlockFace(); return img; -- cgit v1.2.3