Commit 0943fcf3 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Silently ignore empty rectangles in GdipAddPathRectangles.

parent beb83eb4
......@@ -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;
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment