Paul Gofman : gdiplus: Round width and height in gdip_format_string().
Module: wine Branch: master Commit: 5415eb7c3747063b2b92692c987eebceb0107207 URL: https://gitlab.winehq.org/wine/wine/-/commit/5415eb7c3747063b2b92692c987eebc... Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Nov 16 21:37:15 2023 -0600 gdiplus: Round width and height in gdip_format_string(). --- dlls/gdiplus/graphics.c | 4 ++-- dlls/gdiplus/tests/graphics.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 371629a5bef..cc8411d54f7 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5179,8 +5179,8 @@ GpStatus gdip_format_string(HDC hdc, if (!format) format = &default_drawstring_format; - nwidth = rect->Width; - nheight = rect->Height; + nwidth = (int)(rect->Width + 0.005f); + nheight = (int)(rect->Height + 0.005f); if (ignore_empty_clip) { if (!nwidth) nwidth = INT_MAX; diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index de174257994..d71bc78c2ae 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -4770,7 +4770,7 @@ static void test_measure_string(void) set_rect_empty(&rect); rect.Height = height; - rect.Width = width_2 - 0.05; + rect.Width = width_2 - 0.006; set_rect_empty(&bounds); status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines); expect(Ok, status); @@ -4781,6 +4781,19 @@ static void test_measure_string(void) expectf_(width_1, bounds.Width, 0.01); expectf(height, bounds.Height); + set_rect_empty(&rect); + rect.Height = height; + rect.Width = width_2 - 0.004; + set_rect_empty(&bounds); + status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines); + expect(Ok, status); + expect(2, glyphs); + expect(1, lines); + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf_(width_2, bounds.Width, 0.01); + expectf(height, bounds.Height); + /* Default (Near) alignment */ rect.X = 5.0; rect.Y = 5.0;
participants (1)
-
Alexandre Julliard