Module: wine Branch: master Commit: 71eb248c3050a89c9e6291cabbaca1ae15142928 URL: http://source.winehq.org/git/wine.git/?a=commit;h=71eb248c3050a89c9e6291cabb...
Author: Vincent Povirk vincent@codeweavers.com Date: Thu Mar 10 16:51:48 2011 -0600
gdiplus: Implement GdipFillRectangle based on GdipFillPath.
---
dlls/gdiplus/graphics.c | 79 ++++++---------------------------------- dlls/gdiplus/tests/graphics.c | 2 +- 2 files changed, 13 insertions(+), 68 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index b0b4d08..a9f4cf3 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3585,9 +3585,8 @@ GpStatus WINGDIPAPI GdipFillPolygon2I(GpGraphics *graphics, GpBrush *brush, GpStatus WINGDIPAPI GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height) { - INT save_state; - GpPointF ptf[4]; - POINT pti[4]; + GpStatus stat; + GpPath *path;
TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f)\n", graphics, brush, x, y, width, height);
@@ -3597,81 +3596,27 @@ GpStatus WINGDIPAPI GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, if(graphics->busy) return ObjectBusy;
- if(!graphics->hdc) - { - FIXME("graphics object has no HDC\n"); - return Ok; - } - - 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; - - save_state = SaveDC(graphics->hdc); - EndPath(graphics->hdc); - - transform_and_round_points(graphics, pti, ptf, 4); + stat = GdipCreatePath(FillModeAlternate, &path);
- BeginPath(graphics->hdc); - Polygon(graphics->hdc, pti, 4); - EndPath(graphics->hdc); + if (stat == Ok) + { + stat = GdipAddPathRectangle(path, x, y, width, height);
- brush_fill_path(graphics, brush); + if (stat == Ok) + stat = GdipFillPath(graphics, brush, path);
- RestoreDC(graphics->hdc, save_state); + GdipDeletePath(path); + }
- return Ok; + return stat; }
GpStatus WINGDIPAPI GdipFillRectangleI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height) { - INT save_state; - GpPointF ptf[4]; - POINT pti[4]; - TRACE("(%p, %p, %d, %d, %d, %d)\n", graphics, brush, x, y, width, height);
- if(!graphics || !brush) - return InvalidParameter; - - if(graphics->busy) - return ObjectBusy; - - if(!graphics->hdc) - { - FIXME("graphics object has no HDC\n"); - return Ok; - } - - 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; - - save_state = SaveDC(graphics->hdc); - EndPath(graphics->hdc); - - transform_and_round_points(graphics, pti, ptf, 4); - - BeginPath(graphics->hdc); - Polygon(graphics->hdc, pti, 4); - EndPath(graphics->hdc); - - brush_fill_path(graphics, brush); - - RestoreDC(graphics->hdc, save_state); - - return Ok; + return GdipFillRectangle(graphics, brush, x, y, width, height); }
GpStatus WINGDIPAPI GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index ecdbe93..bd14ab6 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -2231,7 +2231,7 @@ static void test_fromMemoryBitmap(void) GdipDeleteGraphics(graphics);
/* drawing writes to the memory provided */ - todo_wine expect(0x68, bits[10]); + expect(0x68, bits[10]);
status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics); expect(Ok, status);