Commit e9bcce6e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus: Implemented GdipGetPenCustom[Start/End]Cap.

parent 4ff6ba0a
...@@ -352,8 +352,8 @@ ...@@ -352,8 +352,8 @@
@ stdcall GdipGetPenColor(ptr ptr) @ stdcall GdipGetPenColor(ptr ptr)
@ stub GdipGetPenCompoundArray @ stub GdipGetPenCompoundArray
@ stub GdipGetPenCompoundCount @ stub GdipGetPenCompoundCount
@ stub GdipGetPenCustomEndCap @ stdcall GdipGetPenCustomEndCap(ptr ptr)
@ stub GdipGetPenCustomStartCap @ stdcall GdipGetPenCustomStartCap(ptr ptr)
@ stdcall GdipGetPenDashArray(ptr ptr long) @ stdcall GdipGetPenDashArray(ptr ptr long)
@ stdcall GdipGetPenDashCap197819(ptr ptr) @ stdcall GdipGetPenDashCap197819(ptr ptr)
@ stdcall GdipGetPenDashCount(ptr ptr) @ stdcall GdipGetPenDashCount(ptr ptr)
......
...@@ -116,6 +116,8 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, ...@@ -116,6 +116,8 @@ 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->customstart = NULL;
gp_pen->customend = NULL;
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");
...@@ -163,6 +165,32 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb) ...@@ -163,6 +165,32 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb); return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb);
} }
GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap)
{
if(!pen || !customCap)
return InvalidParameter;
if(!pen->customend){
*customCap = NULL;
return Ok;
}
return GdipCloneCustomLineCap(pen->customend, customCap);
}
GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap)
{
if(!pen || !customCap)
return InvalidParameter;
if(!pen->customstart){
*customCap = NULL;
return Ok;
}
return GdipCloneCustomLineCap(pen->customstart, customCap);
}
GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count) GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)
{ {
if(!pen || !dash || count > pen->numdashes) if(!pen || !dash || count > pen->numdashes)
...@@ -312,7 +340,8 @@ GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCa ...@@ -312,7 +340,8 @@ GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCa
GpCustomLineCap * cap; GpCustomLineCap * cap;
GpStatus ret; GpStatus ret;
if(!pen || !customCap) return InvalidParameter; /* native crashes on pen == NULL, customCap != NULL */
if(!customCap) return InvalidParameter;
if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){ if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
GdipDeleteCustomLineCap(pen->customend); GdipDeleteCustomLineCap(pen->customend);
...@@ -328,7 +357,8 @@ GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* custom ...@@ -328,7 +357,8 @@ GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* custom
GpCustomLineCap * cap; GpCustomLineCap * cap;
GpStatus ret; GpStatus ret;
if(!pen || !customCap) return InvalidParameter; /* native crashes on pen == NULL, customCap != NULL */
if(!customCap) return InvalidParameter;
if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){ if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
GdipDeleteCustomLineCap(pen->customstart); GdipDeleteCustomLineCap(pen->customstart);
......
...@@ -226,6 +226,55 @@ static void test_dasharray(void) ...@@ -226,6 +226,55 @@ static void test_dasharray(void)
GdipDeletePen(pen); GdipDeletePen(pen);
} }
static void test_customcap(void)
{
GpPen *pen;
GpStatus status;
GpCustomLineCap *custom;
status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
/* NULL args */
status = GdipGetPenCustomStartCap(NULL, NULL);
expect(InvalidParameter, status);
status = GdipGetPenCustomStartCap(pen, NULL);
expect(InvalidParameter, status);
status = GdipGetPenCustomStartCap(NULL, &custom);
expect(InvalidParameter, status);
status = GdipGetPenCustomEndCap(NULL, NULL);
expect(InvalidParameter, status);
status = GdipGetPenCustomEndCap(pen, NULL);
expect(InvalidParameter, status);
status = GdipGetPenCustomEndCap(NULL, &custom);
expect(InvalidParameter, status);
/* native crashes on pen == NULL, custom != NULL */
status = GdipSetPenCustomStartCap(NULL, NULL);
expect(InvalidParameter, status);
status = GdipSetPenCustomStartCap(pen, NULL);
expect(InvalidParameter, status);
status = GdipSetPenCustomEndCap(NULL, NULL);
expect(InvalidParameter, status);
status = GdipSetPenCustomEndCap(pen, NULL);
expect(InvalidParameter, status);
/* get without setting previously */
custom = (GpCustomLineCap*)0xdeadbeef;
status = GdipGetPenCustomEndCap(pen, &custom);
expect(Ok, status);
ok(custom == NULL,"Expect CustomCap == NULL\n");
custom = (GpCustomLineCap*)0xdeadbeef;
status = GdipGetPenCustomStartCap(pen, &custom);
expect(Ok, status);
ok(custom == NULL,"Expect CustomCap == NULL\n");
GdipDeletePen(pen);
}
START_TEST(pen) START_TEST(pen)
{ {
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
...@@ -244,6 +293,7 @@ START_TEST(pen) ...@@ -244,6 +293,7 @@ START_TEST(pen)
test_constructor_destructor2(); test_constructor_destructor2();
test_brushfill(); test_brushfill();
test_dasharray(); test_dasharray();
test_customcap();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);
} }
...@@ -33,6 +33,8 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush*,REAL,GpUnit,GpPen**); ...@@ -33,6 +33,8 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush*,REAL,GpUnit,GpPen**);
GpStatus WINGDIPAPI GdipDeletePen(GpPen*); GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**); GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**);
GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*); GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*);
GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen*,GpCustomLineCap**);
GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen*,GpCustomLineCap**);
GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen*,REAL*,INT); GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen*,REAL*,INT);
GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen*,INT*); GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen*,INT*);
GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen*,REAL*); GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen*,REAL*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment