gdi32: Pre-multiply RGB values by alpha for subpixel font rendering.

This commit is contained in:
Alexandre Julliard 2010-05-17 14:25:14 +02:00
parent c6097cafdd
commit aff0eac21b
1 changed files with 11 additions and 8 deletions

View File

@ -5044,19 +5044,22 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
{
for ( x = 0; x < src_width / hmul; x++ )
{
unsigned int alpha = (src[hmul * x + rgb_interval * 0] +
src[hmul * x + rgb_interval * 1] +
src[hmul * x + rgb_interval * 2]) / 3;
if ( rgb )
{
dst[x] = ((unsigned int)src[hmul * x + rgb_interval * 0] << 16) |
((unsigned int)src[hmul * x + rgb_interval * 1] << 8) |
((unsigned int)src[hmul * x + rgb_interval * 2] << 0) |
((unsigned int)src[hmul * x + rgb_interval * 1] << 24) ;
dst[x] = ((src[hmul * x + rgb_interval * 0] * alpha / 255) << 16) |
((src[hmul * x + rgb_interval * 1] * alpha / 255) << 8) |
((src[hmul * x + rgb_interval * 2] * alpha / 255) << 0) |
(alpha << 24);
}
else
{
dst[x] = ((unsigned int)src[hmul * x + rgb_interval * 2] << 16) |
((unsigned int)src[hmul * x + rgb_interval * 1] << 8) |
((unsigned int)src[hmul * x + rgb_interval * 0] << 0) |
((unsigned int)src[hmul * x + rgb_interval * 1] << 24) ;
dst[x] = ((src[hmul * x + rgb_interval * 2] * alpha / 255) << 16) |
((src[hmul * x + rgb_interval * 1] * alpha / 255) << 8) |
((src[hmul * x + rgb_interval * 0] * alpha / 255) << 0) |
(alpha << 24);
}
}
src += src_pitch * vmul;