Operation should be skipped if SelectClipPath() returns any error. And we should report unexpected error to the caller.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/gdiplus/graphics.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 894e879233..a793665683 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -1050,8 +1050,9 @@ static BOOL brush_can_fill_path(GpBrush *brush, BOOL is_fill) } }
-static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) +static GpStatus brush_fill_path(GpGraphics *graphics, GpBrush *brush) { + GpStatus status = Ok; switch (brush->bt) { case BrushTypeSolidColor: @@ -1064,13 +1065,19 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) RECT rc; /* partially transparent fill */
- SelectClipPath(graphics->hdc, RGN_AND); + if (!SelectClipPath(graphics->hdc, RGN_AND)) + { + status = GenericError; + DeleteObject(bmp); + break; + } if (GetClipBox(graphics->hdc, &rc) != NULLREGION) { HDC hdc = CreateCompatibleDC(NULL);
if (!hdc) { + status = OutOfMemory; DeleteObject(bmp); break; } @@ -1091,7 +1098,11 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) HBRUSH gdibrush, old_brush;
gdibrush = create_gdi_brush(brush); - if (!gdibrush) return; + if (!gdibrush) + { + status = OutOfMemory; + break; + }
old_brush = SelectObject(graphics->hdc, gdibrush); FillPath(graphics->hdc); @@ -1100,6 +1111,8 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) break; } } + + return status; }
static BOOL brush_can_fill_pixels(GpBrush *brush) @@ -4205,7 +4218,7 @@ static GpStatus GDI32_GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath if(retval == Ok) { EndPath(graphics->hdc); - brush_fill_path(graphics, brush); + retval = brush_fill_path(graphics, brush); }
gdi_transform_release(graphics); @@ -4511,13 +4524,13 @@ static GpStatus GDI32_GdipFillRegion(GpGraphics* graphics, GpBrush* brush, Rectangle(graphics->hdc, rc.left, rc.top, rc.right, rc.bottom); EndPath(graphics->hdc);
- brush_fill_path(graphics, brush); + status = brush_fill_path(graphics, brush); }
RestoreDC(graphics->hdc, save_state);
- return Ok; + return status; }
static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush,