diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-03-11 11:22:02 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-03-21 13:21:43 +0000 |
commit | e8a990c67467d60d4b95a94c1b763284e331adcf (patch) | |
tree | f5ed8f794f04e20e3d417d67666ee5651941df36 | |
parent | 12978d4ad03af753130ba7c40b6203491cd86cd5 (diff) |
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>
-rw-r--r-- | src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp index d43b273f4d..6ddcec0256 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp @@ -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); |