gdiplus: Implement GdipGetRegionHRgn for rects.
This commit is contained in:
parent
08aa0cac74
commit
5e77c74f37
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue