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:
parent
beb83eb4ae
commit
0943fcf376
@ -2306,6 +2306,9 @@ GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y,
|
|||||||
if(!path)
|
if(!path)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
|
if (width <= 0.0 || height <= 0.0)
|
||||||
|
return Ok;
|
||||||
|
|
||||||
/* make a backup copy of path data */
|
/* make a backup copy of path data */
|
||||||
if((retstat = GdipClonePath(path, &backup)) != Ok)
|
if((retstat = GdipClonePath(path, &backup)) != Ok)
|
||||||
return retstat;
|
return retstat;
|
||||||
|
@ -1301,6 +1301,7 @@ static void test_empty_rect(void)
|
|||||||
{
|
{
|
||||||
GpPath *path;
|
GpPath *path;
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
|
INT count;
|
||||||
BOOL result;
|
BOOL result;
|
||||||
|
|
||||||
status = GdipCreatePath(FillModeAlternate, &path);
|
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);
|
status = GdipAddPathRectangle(path, 0.0, 0.0, -5.0, 5.0);
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
|
|
||||||
|
status = GdipGetPointCount(path, &count);
|
||||||
|
expect(Ok, status);
|
||||||
|
expect(0, count);
|
||||||
|
|
||||||
status = GdipIsVisiblePathPoint(path, -2.0, 2.0, NULL, &result);
|
status = GdipIsVisiblePathPoint(path, -2.0, 2.0, NULL, &result);
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
expect(FALSE, 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);
|
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, -5.0);
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
|
|
||||||
|
status = GdipGetPointCount(path, &count);
|
||||||
|
expect(Ok, status);
|
||||||
|
expect(0, count);
|
||||||
|
|
||||||
status = GdipAddPathRectangle(path, 0.0, 0.0, 0.0, 5.0);
|
status = GdipAddPathRectangle(path, 0.0, 0.0, 0.0, 5.0);
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
|
|
||||||
|
status = GdipGetPointCount(path, &count);
|
||||||
|
expect(Ok, status);
|
||||||
|
expect(0, count);
|
||||||
|
|
||||||
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.0);
|
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.0);
|
||||||
expect(Ok, status);
|
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);
|
GdipDeletePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user