[try4 2/3] gdi32: cleaned up PolyDraw

Evan Stade estade at gmail.com
Mon Jul 2 16:26:33 CDT 2007


Hi,

Changelog:
*fixed whitespace (from mix of tabs and spaces to just spaces)
*proper release of HDC

 dlls/gdi32/painting.c |   75 ++++++++++++++++++++++++++-----------------------
 1 files changed, 40 insertions(+), 35 deletions(-)

-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index 1b30d6d..8033821 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -833,21 +833,20 @@ BOOL WINAPI PolyDraw(HDC hdc, const POIN
     if(dc->funcs->pPolyDraw)
     {
         result = dc->funcs->pPolyDraw( dc->physDev, lppt, lpbTypes, cCount );
-        GDI_ReleaseObj( hdc );
-        return result;
+        goto end;
     }
-    GDI_ReleaseObj( hdc );
 
     /* check for each bezierto if there are two more points */
     for( i = 0; i < cCount; i++ )
-	if( lpbTypes[i] != PT_MOVETO &&
-	    lpbTypes[i] & PT_BEZIERTO )
-	{
-	    if( cCount < i+3 )
-		return FALSE;
-	    else
-		i += 2;
-	}
+        if( lpbTypes[i] != PT_MOVETO && lpbTypes[i] & PT_BEZIERTO )
+        {
+            if( cCount < i+3 ){
+                result = FALSE;
+                goto end;
+            }
+            else
+                i += 2;
+        }
 
     /* if no moveto occurs, we will close the figure here */
     lastmove.x = dc->CursPosX;
@@ -856,32 +855,38 @@ BOOL WINAPI PolyDraw(HDC hdc, const POIN
     /* now let's draw */
     for( i = 0; i < cCount; i++ )
     {
-	if( lpbTypes[i] == PT_MOVETO )
-	{
-	    MoveToEx( hdc, lppt[i].x, lppt[i].y, NULL );
-	    lastmove.x = dc->CursPosX;
-	    lastmove.y = dc->CursPosY;
-	}
-	else if( lpbTypes[i] & PT_LINETO )
-	    LineTo( hdc, lppt[i].x, lppt[i].y );
-	else if( lpbTypes[i] & PT_BEZIERTO )
-	{
-	    PolyBezierTo( hdc, &lppt[i], 3 );
-	    i += 2;
-	}
-	else
-	    return FALSE;
-
-	if( lpbTypes[i] & PT_CLOSEFIGURE )
-	{
-	    if( PATH_IsPathOpen( dc->path ) )
-		CloseFigure( hdc );
-	    else
-		LineTo( hdc, lastmove.x, lastmove.y );
-	}
+        if( lpbTypes[i] == PT_MOVETO )
+        {
+            MoveToEx( hdc, lppt[i].x, lppt[i].y, NULL );
+            lastmove.x = dc->CursPosX;
+            lastmove.y = dc->CursPosY;
+        }
+        else if( lpbTypes[i] & PT_LINETO )
+            LineTo( hdc, lppt[i].x, lppt[i].y );
+        else if( lpbTypes[i] & PT_BEZIERTO )
+        {
+            PolyBezierTo( hdc, &lppt[i], 3 );
+            i += 2;
+        }
+        else{
+            result = FALSE;
+            goto end;
+        }
+
+        if( lpbTypes[i] & PT_CLOSEFIGURE )
+        {
+            if( PATH_IsOpenPath( dc->path ) )
+                CloseFigure( hdc );
+            else
+                LineTo( hdc, lastmove.x, lastmove.y );
+        }
     }
 
-    return TRUE;
+    result = TRUE;
+
+end:
+    GDI_ReleaseObj( hdc );
+    return result;
 }
 
 
-- 
1.4.1


More information about the wine-patches mailing list