Fix aliased font rendering in native xcb mode

Freetype creates 1bpp bitmaps in msb order, while XRender expects lsb
order.

Change-Id: If8dd8e07c424df2d135f56f1ce105ef94963f536
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
bb10
Eirik Aavitsland 2019-03-11 11:22:02 +01:00
parent 12978d4ad0
commit e8a990c674
1 changed files with 7 additions and 0 deletions

View File

@ -2645,6 +2645,13 @@ bool QXRenderGlyphCache::addGlyphs(const QTextItemInt &ti,
if (glyph == 0 || glyph->format != glyphFormat())
return false;
if (glyph->format == QFontEngine::Format_Mono) {
// Must convert bitmap from msb to lsb bit order
QImage img(glyph->data, glyph->width, glyph->height, QImage::Format_Mono);
img = img.convertToFormat(QImage::Format_MonoLSB);
memcpy(glyph->data, img.constBits(), static_cast<size_t>(img.sizeInBytes()));
}
set->setGlyph(glyphs[i], spp, glyph);
Q_ASSERT(glyph->data || glyph->width == 0 || glyph->height == 0);