Commit bb5f5dba authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Make get_path_hrgn work with HDC-less graphics objects.

parent 5f327f78
......@@ -884,6 +884,7 @@ GpStatus WINGDIPAPI GdipGetRegionDataSize(GpRegion *region, UINT *needed)
static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn)
{
HDC new_hdc=NULL;
GpGraphics *new_graphics=NULL;
GpStatus stat;
INT save_state;
......@@ -893,13 +894,20 @@ static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn)
if (!new_hdc)
return OutOfMemory;
stat = GdipCreateFromHDC(new_hdc, &graphics);
stat = GdipCreateFromHDC(new_hdc, &new_graphics);
graphics = new_graphics;
if (stat != Ok)
{
ReleaseDC(0, new_hdc);
return stat;
}
}
else if (!graphics->hdc)
{
graphics->hdc = new_hdc = GetDC(0);
if (!new_hdc)
return OutOfMemory;
}
save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc);
......@@ -918,7 +926,10 @@ static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn)
if (new_hdc)
{
ReleaseDC(0, new_hdc);
GdipDeleteGraphics(graphics);
if (new_graphics)
GdipDeleteGraphics(new_graphics);
else
graphics->hdc = NULL;
}
return stat;
......
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