Commit 07cf5ed1 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

gdiplus: Report error for brush_fill_path().

Operation should be skipped if SelectClipPath() returns any error. And we should report unexpected error to the caller. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarVincent Povirk <vincent@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d863e268
...@@ -1050,8 +1050,9 @@ static BOOL brush_can_fill_path(GpBrush *brush, BOOL is_fill) ...@@ -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) switch (brush->bt)
{ {
case BrushTypeSolidColor: case BrushTypeSolidColor:
...@@ -1064,13 +1065,19 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) ...@@ -1064,13 +1065,19 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush)
RECT rc; RECT rc;
/* partially transparent fill */ /* 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) if (GetClipBox(graphics->hdc, &rc) != NULLREGION)
{ {
HDC hdc = CreateCompatibleDC(NULL); HDC hdc = CreateCompatibleDC(NULL);
if (!hdc) if (!hdc)
{ {
status = OutOfMemory;
DeleteObject(bmp); DeleteObject(bmp);
break; break;
} }
...@@ -1091,7 +1098,11 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) ...@@ -1091,7 +1098,11 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush)
HBRUSH gdibrush, old_brush; HBRUSH gdibrush, old_brush;
gdibrush = create_gdi_brush(brush); gdibrush = create_gdi_brush(brush);
if (!gdibrush) return; if (!gdibrush)
{
status = OutOfMemory;
break;
}
old_brush = SelectObject(graphics->hdc, gdibrush); old_brush = SelectObject(graphics->hdc, gdibrush);
FillPath(graphics->hdc); FillPath(graphics->hdc);
...@@ -1100,6 +1111,8 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) ...@@ -1100,6 +1111,8 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush)
break; break;
} }
} }
return status;
} }
static BOOL brush_can_fill_pixels(GpBrush *brush) static BOOL brush_can_fill_pixels(GpBrush *brush)
...@@ -4205,7 +4218,7 @@ static GpStatus GDI32_GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath ...@@ -4205,7 +4218,7 @@ static GpStatus GDI32_GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath
if(retval == Ok) if(retval == Ok)
{ {
EndPath(graphics->hdc); EndPath(graphics->hdc);
brush_fill_path(graphics, brush); retval = brush_fill_path(graphics, brush);
} }
gdi_transform_release(graphics); gdi_transform_release(graphics);
...@@ -4511,13 +4524,13 @@ static GpStatus GDI32_GdipFillRegion(GpGraphics* graphics, GpBrush* brush, ...@@ -4511,13 +4524,13 @@ static GpStatus GDI32_GdipFillRegion(GpGraphics* graphics, GpBrush* brush,
Rectangle(graphics->hdc, rc.left, rc.top, rc.right, rc.bottom); Rectangle(graphics->hdc, rc.left, rc.top, rc.right, rc.bottom);
EndPath(graphics->hdc); EndPath(graphics->hdc);
brush_fill_path(graphics, brush); status = brush_fill_path(graphics, brush);
} }
RestoreDC(graphics->hdc, save_state); RestoreDC(graphics->hdc, save_state);
return Ok; return status;
} }
static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush, static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment