gdiplus: Add GdipCreatePen2 and test cases.
This commit is contained in:
parent
b810430f1f
commit
003b5de4f2
|
@ -121,7 +121,7 @@
|
|||
@ stub GdipCreatePathGradientI
|
||||
@ stdcall GdipCreatePathIter(ptr ptr)
|
||||
@ stdcall GdipCreatePen1(long long long ptr)
|
||||
@ stub GdipCreatePen2
|
||||
@ stdcall GdipCreatePen2(ptr long long ptr)
|
||||
@ stub GdipCreateRegion
|
||||
@ stub GdipCreateRegionHrgn
|
||||
@ stub GdipCreateRegionPath
|
||||
|
|
|
@ -86,10 +86,18 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
|
|||
|
||||
GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit,
|
||||
GpPen **pen)
|
||||
{
|
||||
GpBrush *brush;
|
||||
GdipCreateSolidFill(color, (GpSolidFill **)(&brush));
|
||||
return GdipCreatePen2(brush, width, unit, pen);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
|
||||
GpPen **pen)
|
||||
{
|
||||
GpPen *gp_pen;
|
||||
|
||||
if(!pen)
|
||||
if(!pen || !brush)
|
||||
return InvalidParameter;
|
||||
|
||||
gp_pen = GdipAlloc(sizeof(GpPen));
|
||||
|
@ -103,7 +111,7 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit,
|
|||
gp_pen->miterlimit = 10.0;
|
||||
gp_pen->dash = DashStyleSolid;
|
||||
gp_pen->offset = 0.0;
|
||||
GdipCreateSolidFill(color, (GpSolidFill **)(&gp_pen->brush));
|
||||
gp_pen->brush = brush;
|
||||
|
||||
if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
|
||||
FIXME("UnitWorld, UnitPixel only supported units\n");
|
||||
|
|
|
@ -62,6 +62,10 @@ static void test_constructor_destructor(void)
|
|||
GpStatus status;
|
||||
GpPen *pen = NULL;
|
||||
|
||||
status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
ok(pen == NULL, "Expected pen to be NULL\n");
|
||||
|
||||
status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
|
||||
expect(Ok, status);
|
||||
ok(pen != NULL, "Expected pen to be initialized\n");
|
||||
|
@ -73,6 +77,38 @@ static void test_constructor_destructor(void)
|
|||
expect(Ok, status);
|
||||
}
|
||||
|
||||
static void test_constructor_destructor2(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpPen *pen = NULL;
|
||||
GpBrush *brush = NULL;
|
||||
GpPointF points[2];
|
||||
|
||||
status = GdipCreatePen2(NULL, 10.0f, UnitPixel, &pen);
|
||||
expect(InvalidParameter, status);
|
||||
ok(pen == NULL, "Expected pen to be NULL\n");
|
||||
|
||||
points[0].X = 7.0;
|
||||
points[0].Y = 11.0;
|
||||
points[1].X = 13.0;
|
||||
points[1].Y = 17.0;
|
||||
|
||||
status = GdipCreateLineBrush(&points[0], &points[1], (ARGB)0xffff00ff,
|
||||
(ARGB)0xff0000ff, WrapModeTile, (GpLineGradient **)&brush);
|
||||
expect(Ok, status);
|
||||
ok(brush != NULL, "Expected brush to be initialized\n");
|
||||
|
||||
status = GdipCreatePen2(brush, 10.0f, UnitPixel, &pen);
|
||||
expect(Ok, status);
|
||||
ok(pen != NULL, "Expected pen to be initialized\n");
|
||||
|
||||
status = GdipDeletePen(pen);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipDeleteBrush(brush);
|
||||
expect(Ok, status);
|
||||
}
|
||||
|
||||
static void test_brushfill(void)
|
||||
{
|
||||
GpStatus status;
|
||||
|
@ -205,6 +241,7 @@ START_TEST(pen)
|
|||
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
||||
|
||||
test_constructor_destructor();
|
||||
test_constructor_destructor2();
|
||||
test_brushfill();
|
||||
test_dasharray();
|
||||
|
||||
|
|
Loading…
Reference in New Issue