Vincent Povirk : gdiplus: Allow adding rectangles with negative sizes to paths.

Alexandre Julliard julliard at winehq.org
Mon Feb 7 16:06:38 CST 2011


Module: wine
Branch: master
Commit: cd3855f384cc2e9f8095274f1f69b504043cb414
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cd3855f384cc2e9f8095274f1f69b504043cb414

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Sat Feb  5 14:11:50 2011 -0600

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);
 }




More information about the wine-cvs mailing list