gdiplus: Reimplement GdipDrawRectangle using GdipDrawPath.

This commit is contained in:
Dmitry Timoshkov 2013-02-19 11:45:33 +08:00 committed by Alexandre Julliard
parent 981223a736
commit 1223569d64
1 changed files with 9 additions and 25 deletions

View File

@ -3398,9 +3398,8 @@ GpStatus WINGDIPAPI GdipDrawPieI(GpGraphics *graphics, GpPen *pen, INT x,
GpStatus WINGDIPAPI GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x, GpStatus WINGDIPAPI GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x,
REAL y, REAL width, REAL height) REAL y, REAL width, REAL height)
{ {
INT save_state; GpStatus status;
GpPointF ptf[4]; GpPath *path;
POINT pti[4];
TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f)\n", graphics, pen, x, y, width, height); 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) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (!graphics->hdc) status = GdipCreatePath(FillModeAlternate, &path);
{ if (status != Ok) return status;
FIXME("graphics object has no HDC\n");
return Ok;
}
ptf[0].X = x; status = GdipAddPathRectangle(path, x, y, width, height);
ptf[0].Y = y; if (status == Ok)
ptf[1].X = x + width; status = GdipDrawPath(graphics, pen, path);
ptf[1].Y = y;
ptf[2].X = x + width;
ptf[2].Y = y + height;
ptf[3].X = x;
ptf[3].Y = y + height;
save_state = prepare_dc(graphics, pen); GdipDeletePath(path);
SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH)); return status;
transform_and_round_points(graphics, pti, ptf, 4);
Polygon(graphics->hdc, pti, 4);
restore_dc(graphics, save_state);
return Ok;
} }
GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x, GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x,