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>
bb10
Sérgio Martins 2014-11-28 15:18:12 +00:00 committed by Konstantin Ritt
parent 36818ae9ef
commit 33739ccb95
2 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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()