Vincent Povirk : gdiplus: Make get_path_hrgn work with HDC-less graphics objects.
Alexandre Julliard
julliard at winehq.org
Thu Oct 28 12:19:52 CDT 2010
Module: wine
Branch: master
Commit: bb5f5dba93408b43ddafdd22cc1f47a7ae8f60de
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bb5f5dba93408b43ddafdd22cc1f47a7ae8f60de
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Wed Oct 27 17:49:55 2010 -0500
gdiplus: Make get_path_hrgn work with HDC-less graphics objects.
---
dlls/gdiplus/region.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index e9f2d9a..f11f3ca 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -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;
More information about the wine-cvs
mailing list