Evan Stade : gdiplus: Updated draw_pie to use SaveDC/RestoreDC.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 10 08:02:40 CDT 2007


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

Author: Evan Stade <estade at gmail.com>
Date:   Mon Jul  9 20:54:11 2007 -0700

gdiplus: Updated draw_pie to use SaveDC/RestoreDC.

---

 dlls/gdiplus/graphics.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 5f730ab..1040009 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -60,14 +60,16 @@ static void deg2xy(REAL angle, REAL x_0, REAL y_0, REAL *x, REAL *y)
 static GpStatus draw_pie(GpGraphics *graphics, HBRUSH gdibrush, HPEN gdipen,
     REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
 {
-    HGDIOBJ old_pen, old_brush;
+    INT save_state;
     REAL x_0, y_0, x_1, y_1, x_2, y_2;
 
     if(!graphics)
         return InvalidParameter;
 
-    old_pen = SelectObject(graphics->hdc, gdipen);
-    old_brush = SelectObject(graphics->hdc, gdibrush);
+    save_state = SaveDC(graphics->hdc);
+    EndPath(graphics->hdc);
+    SelectObject(graphics->hdc, gdipen);
+    SelectObject(graphics->hdc, gdibrush);
 
     x_0 = x + (width/2.0);
     y_0 = y + (height/2.0);
@@ -78,8 +80,7 @@ static GpStatus draw_pie(GpGraphics *graphics, HBRUSH gdibrush, HPEN gdipen,
     Pie(graphics->hdc, roundr(x), roundr(y), roundr(x+width), roundr(y+height),
         roundr(x_1), roundr(y_1), roundr(x_2), roundr(y_2));
 
-    SelectObject(graphics->hdc, old_pen);
-    SelectObject(graphics->hdc, old_brush);
+    RestoreDC(graphics->hdc, save_state);
 
     return Ok;
 }




More information about the wine-cvs mailing list