[PATCH] gdi32: lcdfilter value is a constant, optimize code (Coverity)

Marcus Meissner meissner at suse.de
Wed Jan 13 09:13:05 CST 2010


Hi,

Previous discussion happened on January 2009, but were fruitless
mostly.

So comment out for now.

Ciao, Marcus
---
 dlls/gdi32/freetype.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index a93cb60..e66726f 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -4974,23 +4974,21 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
             INT x, src_pitch, src_width, src_height, rgb_interval, hmul, vmul;
             INT x_shift, y_shift;
             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 )
+	    /* These changes are valid for FT_LCD_FILTER_DEFAULT and _LIGHT, review
+	     * if we ever change or add other lcdfilter values. */
+            if ( render_mode == FT_RENDER_MODE_LCD)
             {
-                if ( render_mode == FT_RENDER_MODE_LCD)
-                {
-                    lpgm->gmBlackBoxX += 2;
-                    lpgm->gmptGlyphOrigin.x -= 1;
-                }
-                else
-                {
-                    lpgm->gmBlackBoxY += 2;
-                    lpgm->gmptGlyphOrigin.y += 1;
-                }
+                lpgm->gmBlackBoxX += 2;
+                lpgm->gmptGlyphOrigin.x -= 1;
+            }
+            else
+            {
+                lpgm->gmBlackBoxY += 2;
+                lpgm->gmptGlyphOrigin.y += 1;
             }
 
             width  = lpgm->gmBlackBoxX;
@@ -5008,7 +5006,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
                 pFT_Outline_Transform (&ft_face->glyph->outline, &transMat);
 
             if ( pFT_Library_SetLcdFilter )
-                pFT_Library_SetLcdFilter( library, lcdfilter );
+                pFT_Library_SetLcdFilter( library, FT_LCD_FILTER_DEFAULT );
             pFT_Render_Glyph (ft_face->glyph, render_mode);
 
             src = ft_face->glyph->bitmap.buffer;
-- 
1.6.5.7



More information about the wine-patches mailing list