Huw Davies : gdiplus: GdipCreatePen2 should make a copy of the brush.

Alexandre Julliard julliard at winehq.org
Fri Jun 20 06:21:41 CDT 2008


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Jun 19 12:16:20 2008 +0100

gdiplus: GdipCreatePen2 should make a copy of the brush.

---

 dlls/gdiplus/pen.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 9ef1482..f6214f1 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -88,14 +88,19 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit,
     GpPen **pen)
 {
     GpBrush *brush;
+    GpStatus status;
+
     GdipCreateSolidFill(color, (GpSolidFill **)(&brush));
-    return GdipCreatePen2(brush, width, unit, pen);
+    status = GdipCreatePen2(brush, width, unit, pen);
+    GdipDeleteBrush(brush);
+    return status;
 }
 
 GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
     GpPen **pen)
 {
     GpPen *gp_pen;
+    GpBrush *clone_brush;
 
     if(!pen || !brush)
         return InvalidParameter;
@@ -111,7 +116,6 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
     gp_pen->miterlimit = 10.0;
     gp_pen->dash = DashStyleSolid;
     gp_pen->offset = 0.0;
-    gp_pen->brush = brush;
 
     if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
         FIXME("UnitWorld, UnitPixel only supported units\n");
@@ -119,6 +123,9 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
         return NotImplemented;
     }
 
+    GdipCloneBrush(brush, &clone_brush);
+    gp_pen->brush = clone_brush;
+
     *pen = gp_pen;
 
     return Ok;




More information about the wine-cvs mailing list