gdiplus: GdipCreatePen2 should make a copy of the brush.

This commit is contained in:
Huw Davies 2008-06-19 12:16:20 +01:00 committed by Alexandre Julliard
parent d9fa87382e
commit f1fae5ea48
1 changed files with 9 additions and 2 deletions

View File

@ -88,14 +88,19 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit,
GpPen **pen) GpPen **pen)
{ {
GpBrush *brush; GpBrush *brush;
GpStatus status;
GdipCreateSolidFill(color, (GpSolidFill **)(&brush)); 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, GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
GpPen **pen) GpPen **pen)
{ {
GpPen *gp_pen; GpPen *gp_pen;
GpBrush *clone_brush;
if(!pen || !brush) if(!pen || !brush)
return InvalidParameter; return InvalidParameter;
@ -111,7 +116,6 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
gp_pen->miterlimit = 10.0; gp_pen->miterlimit = 10.0;
gp_pen->dash = DashStyleSolid; gp_pen->dash = DashStyleSolid;
gp_pen->offset = 0.0; gp_pen->offset = 0.0;
gp_pen->brush = brush;
if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) { if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
FIXME("UnitWorld, UnitPixel only supported units\n"); FIXME("UnitWorld, UnitPixel only supported units\n");
@ -119,6 +123,9 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
return NotImplemented; return NotImplemented;
} }
GdipCloneBrush(brush, &clone_brush);
gp_pen->brush = clone_brush;
*pen = gp_pen; *pen = gp_pen;
return Ok; return Ok;