gdiplus: Make get_path_hrgn work with HDC-less graphics objects.
This commit is contained in:
parent
5f327f7812
commit
bb5f5dba93
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue