Commit 5415eb7c authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

gdiplus: Round width and height in gdip_format_string().

parent 65f7d5ec
...@@ -5179,8 +5179,8 @@ GpStatus gdip_format_string(HDC hdc, ...@@ -5179,8 +5179,8 @@ GpStatus gdip_format_string(HDC hdc,
if (!format) if (!format)
format = &default_drawstring_format; format = &default_drawstring_format;
nwidth = rect->Width; nwidth = (int)(rect->Width + 0.005f);
nheight = rect->Height; nheight = (int)(rect->Height + 0.005f);
if (ignore_empty_clip) if (ignore_empty_clip)
{ {
if (!nwidth) nwidth = INT_MAX; if (!nwidth) nwidth = INT_MAX;
......
...@@ -4770,7 +4770,7 @@ static void test_measure_string(void) ...@@ -4770,7 +4770,7 @@ static void test_measure_string(void)
set_rect_empty(&rect); set_rect_empty(&rect);
rect.Height = height; rect.Height = height;
rect.Width = width_2 - 0.05; rect.Width = width_2 - 0.006;
set_rect_empty(&bounds); set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines); status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status); expect(Ok, status);
...@@ -4781,6 +4781,19 @@ static void test_measure_string(void) ...@@ -4781,6 +4781,19 @@ static void test_measure_string(void)
expectf_(width_1, bounds.Width, 0.01); expectf_(width_1, bounds.Width, 0.01);
expectf(height, bounds.Height); 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 */ /* Default (Near) alignment */
rect.X = 5.0; rect.X = 5.0;
rect.Y = 5.0; rect.Y = 5.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment