gdiplus: Allow excluding from infinite regions.

This commit is contained in:
Vincent Povirk 2013-10-30 11:46:30 -05:00 committed by Alexandre Julliard
parent c20167dbdc
commit 1202e9af56
2 changed files with 55 additions and 4 deletions

View File

@ -988,8 +988,8 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap
case CombineModeIntersect:
return get_region_hrgn(element->elementdata.combine.right, graphics, hrgn);
case CombineModeXor: case CombineModeExclude:
FIXME("cannot exclude from an infinite region\n");
/* fall-through */
left = CreateRectRgn(-4194304, -4194304, 4194304, 4194304);
break;
case CombineModeUnion: case CombineModeComplement:
*hrgn = NULL;
return Ok;
@ -1013,8 +1013,8 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap
*hrgn = left;
return Ok;
case CombineModeXor: case CombineModeComplement:
FIXME("cannot exclude from an infinite region\n");
/* fall-through */
right = CreateRectRgn(-4194304, -4194304, 4194304, 4194304);
break;
case CombineModeUnion: case CombineModeExclude:
DeleteObject(left);
*hrgn = NULL;

View File

@ -2082,6 +2082,56 @@ static void test_isvisiblerect(void)
ReleaseDC(0, hdc);
}
static void test_excludeinfinite(void)
{
GpStatus status;
GpRegion *region;
UINT count=0xdeadbeef;
GpRectF scans[4];
GpMatrix *identity;
static const RectF rect_exclude = {0.0, 0.0, 1.0, 1.0};
status = GdipCreateMatrix(&identity);
expect(Ok, status);
status = GdipCreateRegion(&region);
expect(Ok, status);
status = GdipCombineRegionRect(region, &rect_exclude, CombineModeExclude);
expect(Ok, status);
status = GdipGetRegionScansCount(region, &count, identity);
expect(Ok, status);
expect(4, count);
count = 4;
status = GdipGetRegionScans(region, scans, (INT*)&count, identity);
expect(Ok, status);
expectf(-4194304.0, scans[0].X);
expectf(-4194304.0, scans[0].Y);
expectf(8388608.0, scans[0].Width);
expectf(4194304.0, scans[0].Height);
expectf(-4194304.0, scans[1].X);
expectf(0.0, scans[1].Y);
expectf(4194304.0, scans[1].Width);
expectf(1.0, scans[1].Height);
expectf(1.0, scans[2].X);
expectf(0.0, scans[2].Y);
expectf(4194303.0, scans[2].Width);
expectf(1.0, scans[2].Height);
expectf(-4194304.0, scans[3].X);
expectf(1.0, scans[3].Y);
expectf(8388608.0, scans[3].Width);
expectf(4194303.0, scans[3].Height);
GdipDeleteRegion(region);
GdipDeleteMatrix(identity);
}
START_TEST(region)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -2107,6 +2157,7 @@ START_TEST(region)
test_getbounds();
test_isvisiblepoint();
test_isvisiblerect();
test_excludeinfinite();
GdiplusShutdown(gdiplusToken);
}