[2/5] gdiplus: updated GdipDrawRectangleI

Evan Stade estade at gmail.com
Mon Jul 9 22:54:18 CDT 2007


Hi,

Using PS_JOIN_MITER allows GdipDrawRectangleI to use Rectangle().

Changelog:
*changed GdipDrawRectangleI to use SaveDC()/RestoreDC()
*changed GdipDrawRectangleI to use Rectangle()
*use PS_JOIN_MITER by default

 dlls/gdiplus/gdiplus_private.h |    2 +-
 dlls/gdiplus/graphics.c        |   26 +++++++-------------------
 2 files changed, 8 insertions(+), 20 deletions(-)

-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 7c5195a..d036057 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -22,7 +22,7 @@ #define __WINE_GP_PRIVATE_H_
 #include "windef.h"
 #include "gdiplus.h"
 
-#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_ENDCAP_FLAT)
+#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_MITER)
 
 COLORREF ARGB2COLORREF(ARGB color);
 
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 1040009..06a5dad 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -590,31 +590,19 @@ GpStatus WINGDIPAPI GdipDrawPie(GpGraphi
 GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x,
     INT y, INT width, INT height)
 {
-    LOGBRUSH lb;
-    HPEN hpen;
-    HGDIOBJ old_obj;
+    INT save_state;
 
     if(!pen || !graphics)
         return InvalidParameter;
 
-    lb.lbStyle = BS_SOLID;
-    lb.lbColor = pen->color;
-    lb.lbHatch = 0;
-
-    hpen = ExtCreatePen(PS_GEOMETRIC | PS_ENDCAP_SQUARE, (INT) pen->width,
-        &lb, 0, NULL);
-
-    old_obj = SelectObject(graphics->hdc, hpen);
+    save_state = SaveDC(graphics->hdc);
+    EndPath(graphics->hdc);
+    SelectObject(graphics->hdc, pen->gdipen);
+    SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH));
 
-    /* assume pen aligment centered */
-    MoveToEx(graphics->hdc, x, y, NULL);
-    LineTo(graphics->hdc, x+width, y);
-    LineTo(graphics->hdc, x+width, y+height);
-    LineTo(graphics->hdc, x, y+height);
-    LineTo(graphics->hdc, x, y);
+    Rectangle(graphics->hdc, x, y, x + width, y + height);
 
-    SelectObject(graphics->hdc, old_obj);
-    DeleteObject(hpen);
+    RestoreDC(graphics->hdc, save_state);
 
     return Ok;
 }
-- 
1.4.1


More information about the wine-patches mailing list