From ef3f172d6ca5a4872174e49d47674a97d3103c0f Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 10 Mar 2011 16:16:26 -0600 Subject: [PATCH 3/9] gdiplus: Add software implementation of GdipFillPath. --- dlls/gdiplus/graphics.c | 66 +++++++++++++++++++++++++++++++++++++---------- 1 files changed, 52 insertions(+), 14 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 83e0f24..2e5e101 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3402,24 +3402,13 @@ GpStatus WINGDIPAPI GdipFillEllipseI(GpGraphics *graphics, GpBrush *brush, INT x return GdipFillEllipse(graphics,brush,(REAL)x,(REAL)y,(REAL)width,(REAL)height); } -GpStatus WINGDIPAPI GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path) +GpStatus WINGDIPAPI GDI32_GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path) { INT save_state; GpStatus retval; - TRACE("(%p, %p, %p)\n", graphics, brush, path); - - if(!brush || !graphics || !path) - return InvalidParameter; - - if(graphics->busy) - return ObjectBusy; - - if(!graphics->hdc) - { - FIXME("graphics object has no HDC\n"); - return Ok; - } + if(!graphics->hdc || !brush_can_fill_path(brush)) + return NotImplemented; save_state = SaveDC(graphics->hdc); EndPath(graphics->hdc); @@ -3444,6 +3433,55 @@ end: return retval; } +GpStatus WINGDIPAPI SOFTWARE_GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path) +{ + GpStatus stat; + GpRegion *rgn; + + if (!brush_can_fill_pixels(brush)) + return NotImplemented; + + /* FIXME: This could probably be done more efficiently without regions. */ + + stat = GdipCreateRegionPath(path, &rgn); + + if (stat == Ok) + { + stat = GdipFillRegion(graphics, brush, rgn); + + GdipDeleteRegion(rgn); + } + + return stat; +} + +GpStatus WINGDIPAPI GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path) +{ + GpStatus stat = NotImplemented; + + TRACE("(%p, %p, %p)\n", graphics, brush, path); + + if(!brush || !graphics || !path) + return InvalidParameter; + + if(graphics->busy) + return ObjectBusy; + + if (!graphics->image) + stat = GDI32_GdipFillPath(graphics, brush, path); + + if (stat == NotImplemented) + stat = SOFTWARE_GdipFillPath(graphics, brush, path); + + if (stat == NotImplemented) + { + FIXME("Not implemented for brushtype %i\n", brush->bt); + stat = Ok; + } + + return stat; +} + GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle) { -- 1.7.2.3