-- v3: gdiplus: Add single point support for GdipGetPathWorldBounds gdiplus/test: add tests for GdipGetPathWorldBounds with single point
From: Bartosz Kosiorek gang65@poczta.onet.pl
--- dlls/gdiplus/tests/graphicspath.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 187d47d1603..e78020f8059 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -586,6 +586,7 @@ static void test_worldbounds(void) expectf(266.8, bounds.Width); expectf(289.6, bounds.Height);
+ /* Bounds from path without any points */ GdipCreatePath(FillModeAlternate, &path); status = GdipGetPathWorldBounds(path, &bounds, matrix, pen); expect(Ok, status); @@ -596,6 +597,19 @@ static void test_worldbounds(void) expectf(0.0, bounds.Width); expectf(0.0, bounds.Height);
+ /* Bounds from path with single point */ + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathLine2(path, &(line2_points[0]), 1); + status = GdipGetPathWorldBounds(path, &bounds, NULL, pen); + expect(Ok, status); + GdipDeletePath(path); + + todo_wine expectf(0.0, bounds.X); + todo_wine expectf(0.0, bounds.Y); + todo_wine expectf(0.0, bounds.Width); + todo_wine expectf(0.0, bounds.Height); + + /* Bounds from path with two points */ GdipCreatePath(FillModeAlternate, &path); GdipAddPathLine2(path, &(line2_points[0]), 2); status = GdipGetPathWorldBounds(path, &bounds, matrix, pen);
From: Bartosz Kosiorek gang65@poczta.onet.pl
--- dlls/gdiplus/graphicspath.c | 2 +- dlls/gdiplus/tests/graphicspath.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 75f08869818..95b4bcc8882 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1624,7 +1624,7 @@ GpStatus WINGDIPAPI GdipGetPathWorldBounds(GpPath* path, GpRectF* bounds,
/* If path is empty just return. */ count = path->pathdata.Count; - if(count == 0){ + if(count < 2){ bounds->X = bounds->Y = bounds->Width = bounds->Height = 0.0; return Ok; } diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index e78020f8059..48894e42dd5 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -604,10 +604,10 @@ static void test_worldbounds(void) expect(Ok, status); GdipDeletePath(path);
- todo_wine expectf(0.0, bounds.X); - todo_wine expectf(0.0, bounds.Y); - todo_wine expectf(0.0, bounds.Width); - todo_wine expectf(0.0, bounds.Height); + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf(0.0, bounds.Width); + expectf(0.0, bounds.Height);
/* Bounds from path with two points */ GdipCreatePath(FillModeAlternate, &path);
On Sat Mar 29 01:57:57 2025 +0000, Esme Povirk wrote:
Yeah, I think returning early in case of 1 point makes sense. I just wouldn't bother putting the matrix translation into the rect, until we either know something needs it or we have to implement other behaviors that make sense of it.
Thanks for feedback. Done