Byeongsik Jeon : gdi32: Don' t truncate the added pixels with FT_LCD_FILTER_DEFAULT.

Alexandre Julliard julliard at winehq.org
Wed Dec 24 13:18:32 CST 2008


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

Author: Byeongsik Jeon <bsjeon at hanmail.net>
Date:   Wed Dec 24 11:16:04 2008 +0900

gdi32: Don't truncate the added pixels with FT_LCD_FILTER_DEFAULT.

---

 dlls/gdi32/freetype.c |   61 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 9eb1d13..d011c97 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -4578,9 +4578,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
           wine_dbgstr_point(&lpgm->gmptGlyphOrigin),
           lpgm->gmCellIncX, lpgm->gmCellIncY);
 
-    if ((format == GGO_METRICS || format == GGO_BITMAP || format ==  WINE_GGO_GRAY16_BITMAP ||
-         format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_HBGR_BITMAP ||
-         format == WINE_GGO_VRGB_BITMAP || format == WINE_GGO_VBGR_BITMAP ) &&
+    if ((format == GGO_METRICS || format == GGO_BITMAP || format ==  WINE_GGO_GRAY16_BITMAP) &&
         (!lpmat || is_identity_MAT2(lpmat))) /* don't cache custom transforms */
     {
         FONT_GM(font,original_index)->gm = *lpgm;
@@ -4741,22 +4739,24 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
     case WINE_GGO_VBGR_BITMAP:
 #ifdef HAVE_FREETYPE_FTLCDFIL_H
       {
-        width  = lpgm->gmBlackBoxX;
-        height = lpgm->gmBlackBoxY;
-        pitch  = width * 4;
-        needed = pitch * height;
-
-        if (!buf || !buflen) break;
-
-        memset(buf, 0, buflen);
-
         switch (ft_face->glyph->format)
         {
         case FT_GLYPH_FORMAT_BITMAP:
           {
-            BYTE *src = ft_face->glyph->bitmap.buffer, *dst = buf;
-            INT src_pitch = ft_face->glyph->bitmap.pitch;
-            INT x;
+            BYTE *src, *dst;
+            INT src_pitch, x;
+
+            width  = lpgm->gmBlackBoxX;
+            height = lpgm->gmBlackBoxY;
+            pitch  = width * 4;
+            needed = pitch * height;
+
+            if (!buf || !buflen) break;
+
+            memset(buf, 0, buflen);
+            dst = buf;
+            src = ft_face->glyph->bitmap.buffer;
+            src_pitch = ft_face->glyph->bitmap.pitch;
 
             while ( height-- )
             {
@@ -4774,15 +4774,40 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
 
         case FT_GLYPH_FORMAT_OUTLINE:
           {
-            unsigned int *dst = (unsigned int *) buf;
+            unsigned int *dst;
             BYTE *src;
             INT x, src_pitch, rgb_interval, hmul, vmul;
-            BOOL rgb = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_VRGB_BITMAP);
+            BOOL rgb;
             FT_LcdFilter lcdfilter = FT_LCD_FILTER_DEFAULT;
             FT_Render_Mode render_mode =
                 (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_HBGR_BITMAP)?
                     FT_RENDER_MODE_LCD: FT_RENDER_MODE_LCD_V;
 
+            if ( lcdfilter == FT_LCD_FILTER_DEFAULT || lcdfilter == FT_LCD_FILTER_LIGHT )
+            {
+                if ( render_mode == FT_RENDER_MODE_LCD)
+                {
+                    lpgm->gmBlackBoxX += 2;
+                    lpgm->gmptGlyphOrigin.x -= 1;
+                }
+                else
+                {
+                    lpgm->gmBlackBoxY += 2;
+                    lpgm->gmptGlyphOrigin.y += 1;
+                }
+            }
+
+            width  = lpgm->gmBlackBoxX;
+            height = lpgm->gmBlackBoxY;
+            pitch  = width * 4;
+            needed = pitch * height;
+
+            if (!buf || !buflen) break;
+
+            memset(buf, 0, buflen);
+            dst = (unsigned int *)buf;
+            rgb = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_VRGB_BITMAP);
+
             if ( needsTransform )
                 pFT_Outline_Transform (&ft_face->glyph->outline, &transMat);
             pFT_Outline_Translate (&ft_face->glyph->outline, -left, -bottom );
@@ -4805,8 +4830,6 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
                 vmul = 3;
             }
 
-            if ( lcdfilter == FT_LCD_FILTER_DEFAULT || lcdfilter == FT_LCD_FILTER_LIGHT )
-                src += rgb_interval * 3;
             while ( height-- )
             {
                 for ( x = 0; x < width; x++ )




More information about the wine-cvs mailing list