Remove historical +4 padding in QFontEngine::alphaMapForGlyph()

Back in the old days, we would pad the output from the font engines
to work around problems with the GL1 paint engine such as issues
with linear sampling, etc. This is no longer needed. Padding is
moved into the glyph cache, and in addition to reducing performance,
the extra padding is also making alphaMapForGlyph() and
alphaMapBoundingBox() fall out of sync when you fall back to
QPainterPath drawing the glyph. The result of this was that,
when prepared, the glyph cache was sometimes not made large enough
to hold what alphaMapForGlyph() actually produced, depending on
the size and order of glyphs, and glyphs ending up at the end of rows
would sometimes be missing from the output.

[ChangeLog][Text] Fixed some instances of missing glyphs when
drawing large fonts.

Change-Id: Ia5982392fe1637f6ebc740db9f226fbb91f75166
Task-number: QTBUG-47547
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2015-10-26 15:20:41 +01:00
parent e0d0e4a9a2
commit 39e023b805

View File

@ -961,7 +961,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
pt.y = -glyph_y; // the baseline
QPainterPath path;
path.setFillRule(Qt::WindingFill);
QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
QImage im(glyph_width, glyph_height, QImage::Format_ARGB32_Premultiplied);
im.fill(Qt::transparent);
QPainter p(&im);
p.setRenderHint(QPainter::Antialiasing);