summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2014-11-28 15:18:12 +0000
committerKonstantin Ritt <ritt.ks@gmail.com>2014-12-04 19:20:58 +0100
commit33739ccb95b5341bbf8173350a66a766277e9bc1 (patch)
tree24a9257d527e601e93424e29b3d2e90b63e9406d
parent36818ae9ef7eba9f93ba33c6ad21a333956c08f7 (diff)
Windows: Bring FreeType rendering up to par with other platforms
The text was very washed out, almost white on small font sizes. This ifdef was introduced to cater for GDI differences between Vista and Pre-Vista, it's GDI specific, nothing to do with FreeType. Text now looks good, and md5sum of the rendering is the same as on Linux. Task-number: QTBUG-42564 Change-Id: I2e06b83b80df093331454fe1b780d26462db597d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
-rw-r--r--src/gui/painting/qdrawhelper.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp6
2 files changed, 11 insertions, 2 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 6482cc50f7..9c1b2e707d 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6219,6 +6219,8 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int
}
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+Q_GUI_EXPORT bool qt_needs_a8_gamma_correction = false;
+
static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uint *gamma, const uchar *invgamma)
{
// Do a gammacorrected gray alphablend...
@@ -6266,6 +6268,7 @@ static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer,
int sb = gamma[qBlue(color)];
bool opaque_src = (qAlpha(color) == 255);
+ bool doGrayBlendPixel = opaque_src && qt_needs_a8_gamma_correction;
#endif
if (!clip) {
@@ -6280,7 +6283,7 @@ static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer,
dest[i] = c;
} else {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && opaque_src
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel
&& qAlpha(dest[i]) == 255) {
grayBlendPixel(dest+i, coverage, sr, sg, sb, gamma, invgamma);
} else
@@ -6321,7 +6324,7 @@ static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer,
dest[xp] = c;
} else {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && opaque_src
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel
&& qAlpha(dest[xp]) == 255) {
grayBlendPixel(dest+xp, coverage, sr, sg, sb, gamma, invgamma);
} else
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 449453cf28..f15783490e 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1062,6 +1062,9 @@ QWindowsFontEngineDataPtr sharedFontData()
}
#endif // QT_NO_THREAD
+#ifndef Q_OS_WINCE
+extern Q_GUI_EXPORT bool qt_needs_a8_gamma_correction;
+#endif
QWindowsFontDatabase::QWindowsFontDatabase()
{
// Properties accessed by QWin32PrintEngine (Qt Print Support)
@@ -1075,6 +1078,9 @@ QWindowsFontDatabase::QWindowsFontDatabase()
qCDebug(lcQpaFonts) << __FUNCTION__ << "Clear type: "
<< data->clearTypeEnabled << "gamma: " << data->fontSmoothingGamma;
}
+#ifndef Q_OS_WINCE
+ qt_needs_a8_gamma_correction = true;
+#endif
}
QWindowsFontDatabase::~QWindowsFontDatabase()