Don't dither antialiasing on glyphs when converting to mono

When glyphs are converted to monochrome from an alpha map,
it does not make sense to apply high quality dithering, because
the result will be that some the subpixels along the edges
that cover only part of a pixel are filled. This causes the
glyphs to look jagged and ugly.

Instead, we use ThresholdDither to fill all pixels that are
>= 50% opacity.

[ChangeLog][QtGui][Text] Improved appearance of monochrome
text on some platforms.

Fixes: QTBUG-69702
Change-Id: I0f44a8d73f6b9f1eb59f297d66438575f1e9db10
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2018-12-20 12:17:30 +01:00
parent e6880e7cd1
commit 28b2232e78

View File

@ -335,7 +335,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
// TODO optimize this
mask = mask.alphaChannel();
mask.invertPixels();
mask = mask.convertToFormat(QImage::Format_Mono);
mask = mask.convertToFormat(QImage::Format_Mono, Qt::ThresholdDither);
}
int mw = qMin(mask.width(), c.w);