[PATCH 2/2] gdi32: Remove the branch and unnecessary operation in the loop.
Byeongsik Jeon
bsjeon at hanmail.net
Thu Oct 4 07:17:22 CDT 2018
* 'if' branch removed in the loop.
* glyph bitmap data is alpha value. Shift 24 part is unnecessary.
Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
---
dlls/gdi32/freetype.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 468c1951b6..1f2ed3af55 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -7323,7 +7323,7 @@ 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;
+ INT rgb[3] = { 0, 1, 2 }; /* WINE_GGO_{H,V}RGB_BITMAP */
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 +7358,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);
@@ -7415,24 +7414,20 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
width = min( width, src_width / hmul );
height = min( height, src_height / vmul );
+ if ( format == WINE_GGO_HBGR_BITMAP || format == WINE_GGO_VBGR_BITMAP)
+ {
+ rgb[0] = 2;
+ rgb[1] = 1;
+ rgb[2] = 0;
+ }
+
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) |
- ((unsigned int)src[hmul * x + rgb_interval * 1] << 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] = ((unsigned int)src[hmul * x + rgb_interval * rgb[0]] << 16) |
+ ((unsigned int)src[hmul * x + rgb_interval * rgb[1]] << 8) |
+ ((unsigned int)src[hmul * x + rgb_interval * rgb[2]]);
}
src += src_pitch * vmul;
dst += pitch / sizeof(*dst);
--
2.19.0
More information about the wine-devel
mailing list