From 07772a2e4f14b32a619200bf29c1e2f69e8261a6 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Sat, 5 Feb 2011 14:11:50 -0600 Subject: [PATCH] gdiplus: Allow adding rectangles with negative sizes to paths. --- dlls/gdiplus/graphicspath.c | 2 +- dlls/gdiplus/tests/graphicspath.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletions(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 983ead9..c9d67b1 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -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 */ diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 2343e9c..9a42153 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -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); } -- 1.7.2.3