mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
gdiplus: Implemented GdipGetPenCustom[Start/End]Cap.
This commit is contained in:
parent
4ff6ba0a4a
commit
e9bcce6e1d
@ -352,8 +352,8 @@
|
||||
@ stdcall GdipGetPenColor(ptr ptr)
|
||||
@ stub GdipGetPenCompoundArray
|
||||
@ stub GdipGetPenCompoundCount
|
||||
@ stub GdipGetPenCustomEndCap
|
||||
@ stub GdipGetPenCustomStartCap
|
||||
@ stdcall GdipGetPenCustomEndCap(ptr ptr)
|
||||
@ stdcall GdipGetPenCustomStartCap(ptr ptr)
|
||||
@ stdcall GdipGetPenDashArray(ptr ptr long)
|
||||
@ stdcall GdipGetPenDashCap197819(ptr ptr)
|
||||
@ stdcall GdipGetPenDashCount(ptr ptr)
|
||||
|
@ -116,6 +116,8 @@ 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->customstart = NULL;
|
||||
gp_pen->customend = NULL;
|
||||
|
||||
if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
|
||||
FIXME("UnitWorld, UnitPixel only supported units\n");
|
||||
@ -163,6 +165,32 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *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)
|
||||
{
|
||||
if(!pen || !dash || count > pen->numdashes)
|
||||
@ -312,7 +340,8 @@ GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCa
|
||||
GpCustomLineCap * cap;
|
||||
GpStatus ret;
|
||||
|
||||
if(!pen || !customCap) return InvalidParameter;
|
||||
/* native crashes on pen == NULL, customCap != NULL */
|
||||
if(!customCap) return InvalidParameter;
|
||||
|
||||
if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
|
||||
GdipDeleteCustomLineCap(pen->customend);
|
||||
@ -328,7 +357,8 @@ GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* custom
|
||||
GpCustomLineCap * cap;
|
||||
GpStatus ret;
|
||||
|
||||
if(!pen || !customCap) return InvalidParameter;
|
||||
/* native crashes on pen == NULL, customCap != NULL */
|
||||
if(!customCap) return InvalidParameter;
|
||||
|
||||
if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
|
||||
GdipDeleteCustomLineCap(pen->customstart);
|
||||
|
@ -226,6 +226,55 @@ static void test_dasharray(void)
|
||||
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)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
@ -244,6 +293,7 @@ START_TEST(pen)
|
||||
test_constructor_destructor2();
|
||||
test_brushfill();
|
||||
test_dasharray();
|
||||
test_customcap();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush*,REAL,GpUnit,GpPen**);
|
||||
GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
|
||||
GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen*,GpBrush**);
|
||||
GpStatus WINGDIPAPI GdipGetPenColor(GpPen*,ARGB*);
|
||||
GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen*,GpCustomLineCap**);
|
||||
GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen*,GpCustomLineCap**);
|
||||
GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen*,REAL*,INT);
|
||||
GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen*,INT*);
|
||||
GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen*,REAL*);
|
||||
|
Loading…
Reference in New Issue
Block a user