Huw Davies : gdi32: Use an array of masks to simplify the bitmap conversion .

Alexandre Julliard julliard at winehq.org
Wed Nov 16 12:46:46 CST 2011


Module: wine
Branch: master
Commit: 48b1e66309ec2dd42ad6b0166cbf184d476f704a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=48b1e66309ec2dd42ad6b0166cbf184d476f704a

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Nov 16 11:20:52 2011 +0000

gdi32: Use an array of masks to simplify the bitmap conversion.

---

 dlls/gdi32/freetype.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 5fb8cda..3a1ae99 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -5049,6 +5049,8 @@ static inline BYTE get_max_level( UINT format )
     return 255;
 }
 
+static const BYTE masks[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
+
 static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
                                LPGLYPHMETRICS lpgm, DWORD buflen, LPVOID buf,
                                const MAT2* lpmat)
@@ -5367,7 +5369,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
             memset( buf, 0, needed );
             while(h--) {
                 for(x = 0; x < pitch && x < ft_face->glyph->bitmap.width; x++)
-                    if (src[x / 8] & (1 << ( (7 - (x % 8))))) dst[x] = max_level;
+                    if (src[x / 8] & masks[x % 8]) dst[x] = max_level;
                 src += ft_face->glyph->bitmap.pitch;
                 dst += pitch;
             }
@@ -5439,7 +5441,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
             {
                 for (x = 0; x < width && x < ft_face->glyph->bitmap.width; x++)
                 {
-                    if ( src[x / 8] & (1 << ( (7 - (x % 8)))) )
+                    if ( src[x / 8] & masks[x % 8] )
                         ((unsigned int *)dst)[x] = ~0u;
                 }
                 src += src_pitch;




More information about the wine-cvs mailing list