gdiplus: Allow adding rectangles with negative sizes to paths.

This commit is contained in:
Vincent Povirk 2011-02-05 14:11:50 -06:00 committed by Alexandre Julliard
parent 29ec595e4a
commit cd3855f384
2 changed files with 30 additions and 1 deletions

View File

@ -1507,7 +1507,7 @@ GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y,
TRACE("(%p, %.2f, %.2f, %.2f, %.2f)\n", path, x, y, width, height);
if(!path || width < 0.0 || height < 0.0)
if(!path)
return InvalidParameter;
/* make a backup copy of path data */

View File

@ -1106,6 +1106,34 @@ static void test_isvisible(void)
ReleaseDC(0, hdc);
}
static void test_empty_rect(void)
{
GpPath *path;
GpStatus status;
BOOL result;
status = GdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
status = GdipAddPathRectangle(path, 0.0, 0.0, -5.0, 5.0);
expect(Ok, status);
status = GdipIsVisiblePathPoint(path, -2.0, 2.0, NULL, &result);
expect(Ok, status);
expect(FALSE, status);
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, -5.0);
expect(Ok, status);
status = GdipAddPathRectangle(path, 0.0, 0.0, 0.0, 5.0);
expect(Ok, status);
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.0);
expect(Ok, status);
GdipDeletePath(path);
}
START_TEST(graphicspath)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -1135,6 +1163,7 @@ START_TEST(graphicspath)
test_addpie();
test_flatten();
test_isvisible();
test_empty_rect();
GdiplusShutdown(gdiplusToken);
}