[PATCH v2 0/2] MR7647: Add single point support for GdipGetPathWorldBounds
-- v2: gdiplus: Add single point support for GdipGetPathWorldBounds gdiplus/test: add tests for GdipGetPathWorldBounds with single point https://gitlab.winehq.org/wine/wine/-/merge_requests/7647
From: Bartosz Kosiorek <gang65(a)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 81b4b40eed4..4640d6bbee6 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, matrix, pen); + expect(Ok, status); + GdipDeletePath(path); + + todo_wine expectf(10.40, bounds.X); + todo_wine expectf(10.20, 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); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7647
From: Bartosz Kosiorek <gang65(a)poczta.onet.pl> --- dlls/gdiplus/graphicspath.c | 7 ++++++- dlls/gdiplus/tests/graphicspath.c | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index cbf8e74340b..0b2af580349 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1624,8 +1624,13 @@ 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; + if(matrix && (count == 1)) + { + bounds->X = matrix->matrix[4]; + bounds->Y = matrix->matrix[5]; + } return Ok; } diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 4640d6bbee6..7377875b296 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(10.40, bounds.X); - todo_wine expectf(10.20, bounds.Y); - todo_wine expectf(0.0, bounds.Width); - todo_wine expectf(0.0, bounds.Height); + expectf(10.40, bounds.X); + expectf(10.20, bounds.Y); + expectf(0.0, bounds.Width); + expectf(0.0, bounds.Height); /* Bounds from path with two points */ GdipCreatePath(FillModeAlternate, &path); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7647
That's a weird behavior. Is there an application that needs this? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7647#note_98822
On Mon Mar 24 09:30:55 2025 +0000, Esme Povirk wrote:
That's a weird behavior. Is there an application that needs this? No. In most cases matrix is not existing, or matrix translation is set to 0.0
I thing it is expected behaviour that with single path point (or zero path points) it returns 0.0 for width and height. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7647#note_98830
On Mon Mar 24 15:59:53 2025 +0000, Bartosz Kosiorek wrote:
No. In most cases matrix is not existing, or matrix translation is set to 0.0 I think it is expected behaviour that with single path point (or zero path points) it returns 0.0 for width and height. 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.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/7647#note_98982
participants (3)
-
Bartosz Kosiorek -
Bartosz Kosiorek (@gang65) -
Esme Povirk (@madewokherd)