summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontenginedirectwrite.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-03-15 09:39:13 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-03-15 10:21:11 +0100
commit6d4ef0ff8fd30e5f50f6f770d651a51584e5cfdc (patch)
tree8613625828bb40cc178b0101f915304bea818d93 /src/gui/text/qfontenginedirectwrite.cpp
parent3c20b3ed8e89e351f1fb459e6ff5439f30958141 (diff)
Fix grayscale antialiasing with DirectWrite engine
The code that converted DirectWrite's output to grayscale in alphaMapForGlyph() had a bunch of copy-paste errors and had obviously not been tested properly. We invert the input to the gamma function to get the right curve and then invert the output back. See windows font engine for comparison. Reviewed-by: Jiang Jiang
Diffstat (limited to 'src/gui/text/qfontenginedirectwrite.cpp')
-rw-r--r--src/gui/text/qfontenginedirectwrite.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp
index 23fff0d740..af5bab2ffe 100644
--- a/src/gui/text/qfontenginedirectwrite.cpp
+++ b/src/gui/text/qfontenginedirectwrite.cpp
@@ -485,12 +485,7 @@ QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPo
uint *src = (uint*) im.scanLine(y);
uchar *dst = indexed.scanLine(y);
for (int x=0; x<im.width(); ++x) {
- *dst = qGray(*src);
- if (QNativeImage::systemFormat() == QImage::Format_RGB16)
- *dst = 255 - qGray(*src);
- else
- *dst = 255 - (qt_pow_gamma[qGray(*src)] * 255. / 2047.);
-
+ *dst = 255 - (qt_pow_gamma[qGray(0xffffffff - *src)] * 255. / 2047.);
++dst;
++src;
}