Commit 6e7b5347 authored by Royal Chan's avatar Royal Chan Committed by Alexandre Julliard

gdiplus: Implement GdipDrawLinesI based on GdipDrawLines.

parent a78727d7
......@@ -188,7 +188,7 @@
@ stdcall GdipDrawLine(ptr ptr long long long long)
@ stdcall GdipDrawLineI(ptr ptr long long long long)
@ stdcall GdipDrawLines(ptr ptr ptr long)
@ stub GdipDrawLinesI
@ stdcall GdipDrawLinesI(ptr ptr ptr long)
@ stdcall GdipDrawPath(ptr ptr ptr)
@ stdcall GdipDrawPie(ptr ptr long long long long long long)
@ stub GdipDrawPieI
......
......@@ -1224,6 +1224,35 @@ GpStatus WINGDIPAPI GdipDrawLines(GpGraphics *graphics, GpPen *pen, GDIPCONST
return retval;
}
GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST
GpPoint *points, INT count)
{
INT save_state;
GpStatus retval;
GpPointF *ptf = NULL;
int i;
if(!pen || !graphics || (count < 2))
return InvalidParameter;
ptf = GdipAlloc(count * sizeof(GpPointF));
if(!ptf) return OutOfMemory;
for(i = 0; i < count; i ++){
ptf[i].X = (REAL) points[i].X;
ptf[i].Y = (REAL) points[i].Y;
}
save_state = prepare_dc(graphics, pen);
retval = draw_polyline(graphics, pen, ptf, count, TRUE);
restore_dc(graphics, save_state);
GdipFree(ptf);
return retval;
}
GpStatus WINGDIPAPI GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path)
{
INT save_state;
......
......@@ -384,6 +384,58 @@ static void test_GdipDrawLineI(void)
ReleaseDC(0, hdc);
}
static void test_GdipDrawLinesI(void)
{
GpStatus status;
GpGraphics *graphics = NULL;
GpPen *pen = NULL;
GpPoint *ptf = NULL;
HDC hdc = GetDC(0);
/* make a graphics object and pen object */
status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(hdc != NULL, "Expected HDC to be initialized\n");
status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(graphics != NULL, "Expected graphics to be initialized\n");
status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
/* make some arbitrary valid points*/
ptf = GdipAlloc(2 * sizeof(GpPointF));
ptf[0].X = 1;
ptf[0].Y = 1;
ptf[1].X = 2;
ptf[1].Y = 2;
/* InvalidParameter cases: null graphics, null pen, null points, count < 2*/
status = GdipDrawLinesI(NULL, NULL, NULL, 0);
expect(InvalidParameter, status);
status = GdipDrawLinesI(graphics, pen, ptf, 0);
expect(InvalidParameter, status);
status = GdipDrawLinesI(graphics, NULL, ptf, 2);
expect(InvalidParameter, status);
status = GdipDrawLinesI(NULL, pen, ptf, 2);
expect(InvalidParameter, status);
/* successful case */
status = GdipDrawLinesI(graphics, pen, ptf, 2);
expect(Ok, status);
GdipFree(ptf);
GdipDeletePen(pen);
ReleaseDC(0, hdc);
}
START_TEST(graphics)
{
struct GdiplusStartupInput gdiplusStartupInput;
......@@ -402,6 +454,7 @@ START_TEST(graphics)
test_GdipDrawArc();
test_GdipDrawArcI();
test_GdipDrawLineI();
test_GdipDrawLinesI();
GdiplusShutdown(gdiplusToken);
}
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