summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_qpf.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-03-11 12:23:32 +0100
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-03-11 15:03:20 +0100
commit5f5c9ba6810071bc7bb369afd2aac99064177ce7 (patch)
tree2af47bae53595a883ac22166b37b715fd75f2504 /src/gui/text/qfontengine_qpf.cpp
parentf18e95849be93b86ff014147086fa538993abc21 (diff)
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
Diffstat (limited to 'src/gui/text/qfontengine_qpf.cpp')
-rw-r--r--src/gui/text/qfontengine_qpf.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 136737dc78..a0593cc478 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);