The rgb part works from text rendering to alpha value. The '24' part is an unnecessary operation.
Signed-off-by: Byeongsik Jeon bsjeon@hanmail.net --- v2: Separated into two patches by Huw Davies's comment.
dlls/gdi32/freetype.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index b95d223138..4a65a9f6c3 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -7422,15 +7422,13 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, { 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) ; + ((unsigned int)src[hmul * x + rgb_interval * 2] << 0); } 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) ; + ((unsigned int)src[hmul * x + rgb_interval * 0] << 0); } } src += src_pitch * vmul;
Signed-off-by: Byeongsik Jeon bsjeon@hanmail.net --- v2: Fix up clearly by Huw Davies's comment.
dlls/gdi32/freetype.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 4a65a9f6c3..5f7af1714f 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -7323,7 +7323,9 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, BYTE *src; INT x, src_pitch, src_width, src_height, rgb_interval, hmul, vmul; INT x_shift, y_shift; - BOOL rgb; + const INT *sub_order; + const INT rgb_order[3] = { 0, 1, 2 }; + const INT bgr_order[3] = { 2, 1, 0 }; FT_Render_Mode render_mode = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_HBGR_BITMAP)? FT_RENDER_MODE_LCD: FT_RENDER_MODE_LCD_V; @@ -7358,7 +7360,6 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
memset(buf, 0, buflen); dst = buf; - rgb = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_VRGB_BITMAP);
if ( needsTransform ) pFT_Outline_Transform (&ft_face->glyph->outline, &transMatTategaki); @@ -7414,22 +7415,16 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, width = min( width, src_width / hmul ); height = min( height, src_height / vmul );
+ sub_order = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_VRGB_BITMAP)? + rgb_order : bgr_order; + while ( height-- ) { for ( x = 0; x < width; x++ ) { - 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); - } - 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); - } + dst[x] = ((unsigned int)src[hmul * x + rgb_interval * sub_order[0]] << 16) | + ((unsigned int)src[hmul * x + rgb_interval * sub_order[1]] << 8) | + ((unsigned int)src[hmul * x + rgb_interval * sub_order[2]]); } src += src_pitch * vmul; dst += pitch / sizeof(*dst);
Signed-off-by: Huw Davies huw@codeweavers.com