From: Vincent Povirk Subject: gdiplus: Reimplement GdipDrawPolygon based on GdipDrawPath. Message-Id: <1476889385-9250-1-git-send-email-madewokherd@gmail.com> Date: Wed, 19 Oct 2016 10:03:05 -0500 From: Vincent Povirk Signed-off-by: Vincent Povirk --- dlls/gdiplus/graphics.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 324c06f..f9a6f3e 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -6164,8 +6164,8 @@ GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST GpPointF *points, INT count) { - INT save_state; - POINT *pti; + GpStatus status; + GpPath* path; TRACE("(%p, %p, %d)\n", graphics, points, count); @@ -6175,24 +6175,16 @@ GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST Gp if(graphics->busy) return ObjectBusy; - if (!graphics->hdc) - { - FIXME("graphics object has no HDC\n"); - return Ok; - } - - pti = heap_alloc_zero(sizeof(POINT) * count); - - save_state = prepare_dc(graphics, pen); - SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH)); + status = GdipCreatePath(FillModeAlternate, &path); + if (status != Ok) return status; - transform_and_round_points(graphics, pti, (GpPointF*)points, count); - Polygon(graphics->hdc, pti, count); + status = GdipAddPathPolygon(path, points, count); + if (status == Ok) + status = GdipDrawPath(graphics, pen, path); - restore_dc(graphics, save_state); - heap_free(pti); + GdipDeletePath(path); - return Ok; + return status; } GpStatus WINGDIPAPI GdipDrawPolygonI(GpGraphics *graphics,GpPen *pen,GDIPCONST GpPoint *points, -- 2.7.4