gdi32: CreatePolyPolygonRgn() returns an empty region when the area is empty.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46655
Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Fabian Maurer 2019-05-22 08:45:10 +01:00 committed by Alexandre Julliard
parent fa54e895a7
commit 9bc6f004ce
2 changed files with 40 additions and 2 deletions

View File

@ -2627,8 +2627,7 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo
if (! (pETEs = HeapAlloc( GetProcessHeap(), 0, sizeof(EdgeTableEntry) * total )))
return 0;
if (!(nb_points = REGION_CreateEdgeTable( Count, nbpolygons, Pts, &ET, pETEs, &SLLBlock, clip_rect )))
goto done;
nb_points = REGION_CreateEdgeTable( Count, nbpolygons, Pts, &ET, pETEs, &SLLBlock, clip_rect );
if (!(obj = alloc_region( nb_points / 2 )))
goto done;

View File

@ -533,6 +533,44 @@ static void test_window_dc_clipping(void)
DestroyWindow(hwnd);
}
static void test_CreatePolyPolygonRgn(void)
{
HRGN region;
POINT points_zero[] = { {0, 0}, {0, 0}, {0, 0} };
POINT points_mixed[] = { {0, 0}, {0, 0}, {0, 0}, {6, 6}, {6, 6}, {6, 6} };
POINT points_six[] = { {6, 6}, {6, 6}, {6, 6} };
POINT points_line[] = { {1, 0}, {11, 0}, {21, 0}};
INT counts_single_poly[] = { 3 };
INT counts_two_poly[] = { 3, 3 };
int ret;
RECT rect;
/* When all polygons are just one point or line, return must not be NULL */
region = CreatePolyPolygonRgn(points_zero, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE);
ok (region != NULL, "region must not be NULL\n");
ret = GetRgnBox(region, &rect);
ok (ret == NULLREGION, "Expected NULLREGION, got %d\n", ret);
DeleteObject(region);
region = CreatePolyPolygonRgn(points_six, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE);
ok (region != NULL, "region must not be NULL\n");
ret = GetRgnBox(region, &rect);
ok (ret == NULLREGION, "Expected NULLREGION, got %d\n", ret);
DeleteObject(region);
region = CreatePolyPolygonRgn(points_line, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE);
ok (region != NULL, "region must not be NULL\n");
ret = GetRgnBox(region, &rect);
ok (ret == NULLREGION, "Expected NULLREGION, got %d\n", ret);
DeleteObject(region);
region = CreatePolyPolygonRgn(points_mixed, counts_two_poly, ARRAY_SIZE(counts_two_poly), ALTERNATE);
ok (region != NULL, "region must not be NULL\n");
ret = GetRgnBox(region, &rect);
ok (ret == NULLREGION, "Expected NULLREGION, got %d\n", ret);
DeleteObject(region);
}
START_TEST(clipping)
{
@ -541,4 +579,5 @@ START_TEST(clipping)
test_GetClipRgn();
test_memory_dc_clipping();
test_window_dc_clipping();
test_CreatePolyPolygonRgn();
}