Commit 003b5de4 authored by Lei Zhang's avatar Lei Zhang Committed by Alexandre Julliard

gdiplus: Add GdipCreatePen2 and test cases.

parent b810430f
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
@ stub GdipCreatePathGradientI @ stub GdipCreatePathGradientI
@ stdcall GdipCreatePathIter(ptr ptr) @ stdcall GdipCreatePathIter(ptr ptr)
@ stdcall GdipCreatePen1(long long long ptr) @ stdcall GdipCreatePen1(long long long ptr)
@ stub GdipCreatePen2 @ stdcall GdipCreatePen2(ptr long long ptr)
@ stub GdipCreateRegion @ stub GdipCreateRegion
@ stub GdipCreateRegionHrgn @ stub GdipCreateRegionHrgn
@ stub GdipCreateRegionPath @ stub GdipCreateRegionPath
......
...@@ -87,9 +87,17 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen) ...@@ -87,9 +87,17 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit, GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit,
GpPen **pen) 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; GpPen *gp_pen;
if(!pen) if(!pen || !brush)
return InvalidParameter; return InvalidParameter;
gp_pen = GdipAlloc(sizeof(GpPen)); gp_pen = GdipAlloc(sizeof(GpPen));
...@@ -103,7 +111,7 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit, ...@@ -103,7 +111,7 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, 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;
GdipCreateSolidFill(color, (GpSolidFill **)(&gp_pen->brush)); gp_pen->brush = brush;
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");
......
...@@ -62,6 +62,10 @@ static void test_constructor_destructor(void) ...@@ -62,6 +62,10 @@ static void test_constructor_destructor(void)
GpStatus status; GpStatus status;
GpPen *pen = NULL; 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); status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status); expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n"); ok(pen != NULL, "Expected pen to be initialized\n");
...@@ -73,6 +77,38 @@ static void test_constructor_destructor(void) ...@@ -73,6 +77,38 @@ static void test_constructor_destructor(void)
expect(Ok, status); 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) static void test_brushfill(void)
{ {
GpStatus status; GpStatus status;
...@@ -205,6 +241,7 @@ START_TEST(pen) ...@@ -205,6 +241,7 @@ START_TEST(pen)
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor(); test_constructor_destructor();
test_constructor_destructor2();
test_brushfill(); test_brushfill();
test_dasharray(); test_dasharray();
......
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