[7/16] gdiplus: added custom line cap setters [try2]
Evan Stade
estade at gmail.com
Thu Jul 19 20:22:43 CDT 2007
Hi,
dlls/gdiplus/gdiplus.spec | 4 ++--
dlls/gdiplus/gdiplus_private.h | 2 ++
dlls/gdiplus/pen.c | 43 ++++++++++++++++++++++++++++++++++++++++
include/gdiplusflat.h | 2 ++
4 files changed, 49 insertions(+), 2 deletions(-)
--
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 1d8e424..755a70d 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -544,8 +544,8 @@
@ stub GdipSetPenBrushFill
@ stub GdipSetPenColor
@ stub GdipSetPenCompoundArray
-@ stub GdipSetPenCustomEndCap
-@ stub GdipSetPenCustomStartCap
+@ stdcall GdipSetPenCustomEndCap(ptr ptr)
+@ stdcall GdipSetPenCustomStartCap(ptr ptr)
@ stub GdipSetPenDashArray
@ stub GdipSetPenDashCap197819
@ stub GdipSetPenDashOffset
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 5350a19..206d86c 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -49,6 +49,8 @@ struct GpPen{
GpLineCap endcap;
GpLineCap startcap;
GpDashCap dashcap;
+ GpCustomLineCap *customstart;
+ GpCustomLineCap *customend;
GpLineJoin join;
REAL miterlimit;
GpDashStyle dash;
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 52ee8e2..9601f8c 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -130,6 +130,9 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen
{
if(!pen) return InvalidParameter;
DeleteObject(pen->gdipen);
+
+ GdipDeleteCustomLineCap(pen->customstart);
+ GdipDeleteCustomLineCap(pen->customend);
GdipFree(pen);
return Ok;
@@ -145,6 +148,38 @@ GpStatus WINGDIPAPI GdipGetPenDashStyle(
return Ok;
}
+GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap)
+{
+ GpCustomLineCap * cap;
+ GpStatus ret;
+
+ if(!pen || !customCap) return InvalidParameter;
+
+ if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
+ GdipDeleteCustomLineCap(pen->customend);
+ pen->endcap = LineCapCustom;
+ pen->customend = cap;
+ }
+
+ return ret;
+}
+
+GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap)
+{
+ GpCustomLineCap * cap;
+ GpStatus ret;
+
+ if(!pen || !customCap) return InvalidParameter;
+
+ if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
+ GdipDeleteCustomLineCap(pen->customstart);
+ pen->startcap = LineCapCustom;
+ pen->customstart = cap;
+ }
+
+ return ret;
+}
+
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
{
LOGBRUSH lb;
@@ -171,6 +206,9 @@ GpStatus WINGDIPAPI GdipSetPenEndCap(GpP
{
if(!pen) return InvalidParameter;
+ /* The old custom cap gets deleted even if the new style is LineCapCustom. */
+ GdipDeleteCustomLineCap(pen->customend);
+ pen->customend = NULL;
pen->endcap = cap;
return Ok;
@@ -183,6 +221,11 @@ GpStatus WINGDIPAPI GdipSetPenLineCap197
if(!pen)
return InvalidParameter;
+ GdipDeleteCustomLineCap(pen->customend);
+ GdipDeleteCustomLineCap(pen->customstart);
+ pen->customend = NULL;
+ pen->customstart = NULL;
+
pen->startcap = start;
pen->endcap = end;
pen->dashcap = dash;
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 901e03b..365e81a 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -31,6 +31,8 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen*,
GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**);
GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen*,GpDashStyle*);
+GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen*,GpCustomLineCap*);
+GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen*,GpCustomLineCap*);
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen*,GpDashStyle);
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap);
GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap);
--
1.4.1
More information about the wine-patches
mailing list