Vincent Povirk : gdiplus: Implement GdipGetRegionHRgn for rects.
Alexandre Julliard
julliard at winehq.org
Tue Nov 25 07:21:50 CST 2008
Module: wine
Branch: master
Commit: 5e77c74f37f38f69c86b19a7259c3d8aef5c7d39
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5e77c74f37f38f69c86b19a7259c3d8aef5c7d39
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Mon Nov 24 16:06:32 2008 -0600
gdiplus: Implement GdipGetRegionHRgn for rects.
---
dlls/gdiplus/region.c | 18 ++++++++++++++++++
dlls/gdiplus/tests/region.c | 13 +++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index 5580319..509c7ce 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -823,6 +823,24 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap
return *hrgn ? Ok : OutOfMemory;
case RegionDataPath:
return get_path_hrgn(element->elementdata.pathdata.path, graphics, 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, graphics, hrgn);
+
+ GdipDeletePath(path);
+
+ return stat;
+ }
default:
FIXME("GdipGetRegionHRgn unimplemented for region type=%x\n", element->type);
*hrgn = NULL;
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index 45ef0b1..34024be 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -804,6 +804,7 @@ static void test_gethrgn(void)
HDC hdc=GetDC(0);
static const RECT empty_rect = {0,0,0,0};
static const RECT test_rect = {10, 11, 20, 21};
+ static const GpRectF test_rectF = {10.0, 11.0, 10.0, 10.0};
static const RECT scaled_rect = {20, 22, 40, 42};
status = GdipCreateFromHDC(hdc, &graphics);
@@ -854,6 +855,18 @@ static void test_gethrgn(void)
verify_region(hrgn, &scaled_rect);
DeleteObject(hrgn);
+ status = GdipCombineRegionRect(region2, &test_rectF, CombineModeReplace);
+ ok(status == Ok, "status %08x\n", status);
+ status = GdipGetRegionHRgn(region2, NULL, &hrgn);
+ ok(status == Ok, "status %08x\n", status);
+ verify_region(hrgn, &test_rect);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region2, graphics, &hrgn);
+ ok(status == Ok, "status %08x\n", status);
+ verify_region(hrgn, &scaled_rect);
+ DeleteObject(hrgn);
+
status = GdipDeletePath(path);
ok(status == Ok, "status %08x\n", status);
status = GdipDeleteRegion(region);
More information about the wine-cvs
mailing list