From 1223569d644fdfb4e9b920ceeb18079dc6d819c8 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 19 Feb 2013 11:45:33 +0800 Subject: [PATCH] gdiplus: Reimplement GdipDrawRectangle using GdipDrawPath. --- dlls/gdiplus/graphics.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 201ef7b89fd..39c2b0fa457 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3398,9 +3398,8 @@ GpStatus WINGDIPAPI GdipDrawPieI(GpGraphics *graphics, GpPen *pen, INT x, GpStatus WINGDIPAPI GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height) { - INT save_state; - GpPointF ptf[4]; - POINT pti[4]; + GpStatus status; + GpPath *path; TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f)\n", graphics, pen, x, y, width, height); @@ -3410,30 +3409,15 @@ GpStatus WINGDIPAPI GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x, if(graphics->busy) return ObjectBusy; - if (!graphics->hdc) - { - FIXME("graphics object has no HDC\n"); - return Ok; - } + status = GdipCreatePath(FillModeAlternate, &path); + if (status != Ok) return status; - ptf[0].X = x; - ptf[0].Y = y; - ptf[1].X = x + width; - ptf[1].Y = y; - ptf[2].X = x + width; - ptf[2].Y = y + height; - ptf[3].X = x; - ptf[3].Y = y + height; + status = GdipAddPathRectangle(path, x, y, width, height); + if (status == Ok) + status = GdipDrawPath(graphics, pen, path); - save_state = prepare_dc(graphics, pen); - SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH)); - - transform_and_round_points(graphics, pti, ptf, 4); - Polygon(graphics->hdc, pti, 4); - - restore_dc(graphics, save_state); - - return Ok; + GdipDeletePath(path); + return status; } GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x,