Just some cleanups from the recent changes.
From: Esme Povirk esme@codeweavers.com
We no longer transform the path in this function. --- dlls/gdiplus/region.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c index 1f053828add..999c5cf4e96 100644 --- a/dlls/gdiplus/region.c +++ b/dlls/gdiplus/region.c @@ -1189,7 +1189,7 @@ static GpStatus edge_list_to_rgndata(struct edge_list *edges, FillMode fill_mode static GpStatus get_path_hrgn(GpPath *path, const RECT *bounds, HRGN *hrgn) { GpStatus stat = Ok; - GpPath *transformed_path = NULL; + GpPath *flat_path = NULL; struct edge_list edge_list = { 0 }; RGNDATA *rgndata = NULL;
@@ -1200,14 +1200,14 @@ static GpStatus get_path_hrgn(GpPath *path, const RECT *bounds, HRGN *hrgn) }
if (stat == Ok) - stat = GdipClonePath(path, &transformed_path); + stat = GdipClonePath(path, &flat_path);
if (stat == Ok) - stat = GdipFlattenPath(transformed_path, NULL, FlatnessDefault); + stat = GdipFlattenPath(flat_path, NULL, FlatnessDefault);
/* build edge list */ if (stat == Ok) - stat = flat_path_to_edge_list(transformed_path, bounds, &edge_list); + stat = flat_path_to_edge_list(flat_path, bounds, &edge_list);
/* transform edge list into scans list */ if (stat == Ok) @@ -1223,8 +1223,8 @@ static GpStatus get_path_hrgn(GpPath *path, const RECT *bounds, HRGN *hrgn) free(edge_list.edges); free(rgndata);
- if (transformed_path != NULL) - GdipDeletePath(transformed_path); + if (flat_path != NULL) + GdipDeletePath(flat_path);
return stat; }
From: Esme Povirk esme@codeweavers.com
Since we no longer pass in a transform, we don't have to use path code for this. --- dlls/gdiplus/region.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c index 999c5cf4e96..5334a06b1a0 100644 --- a/dlls/gdiplus/region.c +++ b/dlls/gdiplus/region.c @@ -1243,21 +1243,14 @@ static GpStatus get_region_hrgn(struct region_element *element, const RECT *boun return get_path_hrgn(element->elementdata.path, bounds, hrgn); case RegionDataRect: { - GpPath* path; - GpStatus stat; GpRectF* rc = &element->elementdata.rect;
- stat = GdipCreatePath(FillModeAlternate, &path); - if (stat != Ok) - return stat; - stat = GdipAddPathRectangle(path, rc->X, rc->Y, rc->Width, rc->Height); - - if (stat == Ok) - stat = get_path_hrgn(path, bounds, hrgn); - - GdipDeletePath(path); - - return stat; + if (rc->Width <= 0.0 || rc->Height <= 0.0) + *hrgn = CreateRectRgn(0, 0, 0, 0); + else + *hrgn = CreateRectRgn(rgn_round(rc->X), rgn_round(rc->Y), + rgn_round(rc->X + rc->Width), rgn_round(rc->Y + rc->Height)); + return *hrgn ? Ok : OutOfMemory; } case CombineModeIntersect: case CombineModeUnion: