[5/6] gdiplus: added GdipSetPenDashArray/GdipGetPenDashArray
Evan Stade
estade at gmail.com
Wed Jul 25 21:15:38 CDT 2007
Hi,
dlls/gdiplus/gdiplus.spec | 4 ++--
dlls/gdiplus/gdiplus_private.h | 2 ++
dlls/gdiplus/pen.c | 44 ++++++++++++++++++++++++++++++++++++++++
include/gdiplusflat.h | 2 ++
4 files changed, 50 insertions(+), 2 deletions(-)
--
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 02b1e18..cf08c90 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -338,7 +338,7 @@
@ stub GdipGetPenCompoundCount
@ stub GdipGetPenCustomEndCap
@ stub GdipGetPenCustomStartCap
-@ stub GdipGetPenDashArray
+@ stdcall GdipGetPenDashArray(ptr ptr long)
@ stub GdipGetPenDashCap197819
@ stub GdipGetPenDashCount
@ stub GdipGetPenDashOffset
@@ -546,7 +546,7 @@
@ stub GdipSetPenCompoundArray
@ stdcall GdipSetPenCustomEndCap(ptr ptr)
@ stdcall GdipSetPenCustomStartCap(ptr ptr)
-@ stub GdipSetPenDashArray
+@ stdcall GdipSetPenDashArray(ptr ptr long)
@ stub GdipSetPenDashCap197819
@ stub GdipSetPenDashOffset
@ stdcall GdipSetPenDashStyle(ptr long)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 79800c2..f20ea3d 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -54,6 +54,8 @@ struct GpPen{
GpLineJoin join;
REAL miterlimit;
GpDashStyle dash;
+ REAL *dashes;
+ INT numdashes;
GpBrush *brush;
};
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 3026d52..e582f76 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -123,6 +123,7 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen
GdipDeleteBrush(pen->brush);
GdipDeleteCustomLineCap(pen->customstart);
GdipDeleteCustomLineCap(pen->customend);
+ GdipFree(pen->dashes);
GdipFree(pen);
return Ok;
@@ -147,6 +148,20 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPe
return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb);
}
+GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)
+{
+ if(!pen || !dash || count > pen->numdashes)
+ return InvalidParameter;
+
+ /* note: if you pass a negative value for count, it crashes native gdiplus. */
+ if(count < 0)
+ return GenericError;
+
+ memcpy(dash, pen->dashes, count * sizeof(REAL));
+
+ return Ok;
+}
+
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
{
if(!pen || !dash)
@@ -209,11 +224,40 @@ GpStatus WINGDIPAPI GdipSetPenCustomStar
return ret;
}
+GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
+ INT count)
+{
+ if(!pen || !dash)
+ return InvalidParameter;
+
+ GdipFree(pen->dashes);
+ pen->dashes = NULL;
+
+ if(count > 0)
+ pen->dashes = GdipAlloc(count * sizeof(REAL));
+ if(!pen->dashes){
+ pen->numdashes = 0;
+ return OutOfMemory;
+ }
+
+ pen->dash = DashStyleCustom;
+ memcpy(pen->dashes, dash, count * sizeof(REAL));
+ pen->numdashes = count;
+
+ return Ok;
+}
+
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
{
if(!pen)
return InvalidParameter;
+ if(dash != DashStyleCustom){
+ GdipFree(pen->dashes);
+ pen->dashes = NULL;
+ pen->numdashes = 0;
+ }
+
pen->dash = dash;
pen->style &= ~(PS_ALTERNATE | PS_SOLID | PS_DASH | PS_DOT | PS_DASHDOT |
PS_DASHDOTDOT | PS_NULL | PS_USERSTYLE | PS_INSIDEFRAME);
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index d56c45c..eabdbfb 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -32,11 +32,13 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB,
GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**);
GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*);
+GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen*,REAL*,INT);
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen*,GpDashStyle*);
GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen*,GpBrush*);
GpStatus WINGDIPAPI GdipSetPenColor(GpPen*,ARGB);
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen*,GpCustomLineCap*);
GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen*,GpCustomLineCap*);
+GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen*,GDIPCONST REAL*,INT);
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