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 <ritt.ks@gmail.com>bb10
parent
cc0636ea1e
commit
0b7beaaaf2
|
|
@ -1934,8 +1934,6 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition)
|
|||
lockFace();
|
||||
|
||||
QScopedPointer<Glyph> 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> 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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue