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: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2018-06-20 15:13:49 +08:00 committed by Alexandre Julliard
parent d863e26834
commit 07cf5ed189
1 changed files with 19 additions and 6 deletions

View File

@ -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,