diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-03-11 11:23:32 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-03-11 14:03:20 (GMT) |
commit | 5f5c9ba6810071bc7bb369afd2aac99064177ce7 (patch) | |
tree | 2af47bae53595a883ac22166b37b715fd75f2504 | |
parent | f18e95849be93b86ff014147086fa538993abc21 (diff) | |
download | Qt-5f5c9ba6810071bc7bb369afd2aac99064177ce7.zip Qt-5f5c9ba6810071bc7bb369afd2aac99064177ce7.tar.gz Qt-5f5c9ba6810071bc7bb369afd2aac99064177ce7.tar.bz2 |
Fix 1-bit to 8-bit conversion for bitmap fonts on QWS
QImage doesn't know that we are abusing Format_Indexed8 as an alpha
map. The proper solution is to add new image formats. This is just a
quick fix.
Task-number: QTBUG-5936
Reviewed-by: Jeremy
-rw-r--r-- | src/gui/text/qfontengine_qpf.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 136737d..a0593cc 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -920,8 +920,18 @@ void QFontEngineQPF::loadGlyph(glyph_t glyph) if (!renderingFontEngine) return; - - QImage img = renderingFontEngine->alphaMapForGlyph(glyph).convertToFormat(QImage::Format_Indexed8); + QImage img = renderingFontEngine->alphaMapForGlyph(glyph); + if (img.format() != QImage::Format_Indexed8) { + bool mono = img.depth() == 1; + img = img.convertToFormat(QImage::Format_Indexed8); + if (mono) { + //### we know that 1 is opaque and 0 is transparent + uchar *byte = img.bits(); + int count = img.byteCount(); + while (count--) + *byte++ *= 0xff; + } + } glyph_metrics_t metrics = renderingFontEngine->boundingBox(glyph); renderingFontEngine->removeGlyphFromCache(glyph); |