gdiplus: Silently ignore empty rectangles in GdipAddPathRectangles.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2018-02-28 09:49:29 -06:00 committed by Alexandre Julliard
parent beb83eb4ae
commit 0943fcf376
2 changed files with 27 additions and 0 deletions

View File

@ -2306,6 +2306,9 @@ GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y,
if(!path)
return InvalidParameter;
if (width <= 0.0 || height <= 0.0)
return Ok;
/* make a backup copy of path data */
if((retstat = GdipClonePath(path, &backup)) != Ok)
return retstat;

View File

@ -1301,6 +1301,7 @@ static void test_empty_rect(void)
{
GpPath *path;
GpStatus status;
INT count;
BOOL result;
status = GdipCreatePath(FillModeAlternate, &path);
@ -1309,6 +1310,10 @@ static void test_empty_rect(void)
status = GdipAddPathRectangle(path, 0.0, 0.0, -5.0, 5.0);
expect(Ok, status);
status = GdipGetPointCount(path, &count);
expect(Ok, status);
expect(0, count);
status = GdipIsVisiblePathPoint(path, -2.0, 2.0, NULL, &result);
expect(Ok, status);
expect(FALSE, status);
@ -1316,12 +1321,31 @@ static void test_empty_rect(void)
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, -5.0);
expect(Ok, status);
status = GdipGetPointCount(path, &count);
expect(Ok, status);
expect(0, count);
status = GdipAddPathRectangle(path, 0.0, 0.0, 0.0, 5.0);
expect(Ok, status);
status = GdipGetPointCount(path, &count);
expect(Ok, status);
expect(0, count);
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.0);
expect(Ok, status);
status = GdipGetPointCount(path, &count);
expect(Ok, status);
expect(0, count);
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.1);
expect(Ok, status);
status = GdipGetPointCount(path, &count);
expect(Ok, status);
expect(4, count);
GdipDeletePath(path);
}