Module: wine Branch: master Commit: 0943fcf3761be29a011328f1eb5847aaee6ed835 URL: https://source.winehq.org/git/wine.git/?a=commit;h=0943fcf3761be29a011328f1e...
Author: Vincent Povirk vincent@codeweavers.com Date: Wed Feb 28 09:49:29 2018 -0600
gdiplus: Silently ignore empty rectangles in GdipAddPathRectangles.
Signed-off-by: Vincent Povirk vincent@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdiplus/graphicspath.c | 3 +++ dlls/gdiplus/tests/graphicspath.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 8b13fc5..76ef1c2 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -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; diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 9a6dde3..102c33c 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -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); }