[1/2] gdiplus: change way GdipDrawLineI saves state

Evan Stade estade at gmail.com
Mon Jul 2 17:13:05 CDT 2007


Hi,

I plan to eventually make this change to all GdipDraw functions.

Changelog:
*use SaveDC, RestoreDC in GdipDrawLineI

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

-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 5ac16f7..453cbe5 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -247,15 +247,18 @@ GpStatus WINGDIPAPI GdipDrawCurve2(GpGra
 GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1,
     INT y1, INT x2, INT y2)
 {
-    HGDIOBJ old_obj;
+    INT save_state;
 
     if(!pen || !graphics)
         return InvalidParameter;
 
-    old_obj = SelectObject(graphics->hdc, pen->gdipen);
+    save_state = SaveDC(graphics->hdc);
+    SelectObject(graphics->hdc, pen->gdipen);
+
     MoveToEx(graphics->hdc, x1, y1, NULL);
     LineTo(graphics->hdc, x2, y2);
-    SelectObject(graphics->hdc, old_obj);
+
+    RestoreDC(graphics->hdc, save_state);
 
     return Ok;
 }
-- 
1.4.1


More information about the wine-patches mailing list