[05/17] gdiplus: GdipMeasureString should apply its internal scaling factors to layout rectangle.
Dmitry Timoshkov
dmitry at baikal.ru
Wed Aug 8 22:56:00 CDT 2012
---
dlls/gdiplus/graphics.c | 10 ++++++++--
dlls/gdiplus/tests/graphics.c | 29 -----------------------------
2 files changed, 8 insertions(+), 31 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 41034e5..16e1bc0 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -4999,7 +4999,7 @@ static GpStatus measure_string_callback(HDC hdc,
REAL new_width, new_height;
new_width = bounds->Width / args->rel_width;
- new_height = (bounds->Height + bounds->Y - args->bounds->Y) / args->rel_height;
+ new_height = (bounds->Height + bounds->Y) / args->rel_height - args->bounds->Y;
if (new_width > args->bounds->Width)
args->bounds->Width = new_width;
@@ -5029,6 +5029,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
struct measure_string_args args;
HDC temp_hdc=NULL, hdc;
GpPointF pt[3];
+ RectF scaled_rect;
TRACE("(%p, %s, %i, %p, %s, %p, %p, %p, %p)\n", graphics,
debugstr_wn(string, length), length, font, debugstr_rectf(rect), format,
@@ -5066,6 +5067,11 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
get_font_hfont(graphics, font, &gdifont);
oldfont = SelectObject(hdc, gdifont);
+ scaled_rect.X = rect->X * args.rel_width;
+ scaled_rect.Y = rect->Y * args.rel_height;
+ scaled_rect.Width = rect->Width * args.rel_width;
+ scaled_rect.Height = rect->Height * args.rel_height;
+
bounds->X = rect->X;
bounds->Y = rect->Y;
bounds->Width = 0.0;
@@ -5075,7 +5081,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
args.codepointsfitted = codepointsfitted;
args.linesfilled = linesfilled;
- gdip_format_string(hdc, string, length, font, rect, format,
+ gdip_format_string(hdc, string, length, font, &scaled_rect, format,
measure_string_callback, &args);
SelectObject(hdc, oldfont);
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 9132ff8..33f9ddd 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -3513,13 +3513,6 @@ static void test_GdipMeasureString(void)
expect(Ok, status);
expectf(50.0, bounds.X);
expectf(50.0, bounds.Y);
- /* FIXME: remove once Wine is fixed */
- if (fabs(height - bounds.Height) > height / 100.0)
- {
- /* further testing is useless */
- GdipDeleteGraphics(graphics);
- continue;
- }
expectf_(height, bounds.Height, height / 100.0);
expectf_(bounds.Height / base_cy, bounds.Width / base_cx, 0.05);
expect(7, chars);
@@ -3584,23 +3577,8 @@ static void test_GdipMeasureString(void)
base_cy = bounds.Height;
}
- /* FIXME: remove once Wine is fixed */
- if (fabs(height - bounds.Height) > height / 85.0)
- {
- /* further testing is useless */
- GdipDeleteGraphics(graphics);
- continue;
- }
-
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
- /* FIXME: remove once Wine is fixed */
- if (fabs(height - bounds.Height) > height / 85.0)
- {
- /* further testing is useless */
- GdipDeleteGraphics(graphics);
- continue;
- }
expectf_(height, bounds.Height, height / 85.0);
expectf_(bounds.Height / base_cy, bounds.Width / base_cx, 0.05);
expect(7, chars);
@@ -3617,13 +3595,6 @@ static void test_GdipMeasureString(void)
expect(Ok, status);
expectf(50.0, bounds.X);
expectf(50.0, bounds.Y);
- /* FIXME: remove once Wine is fixed */
- if (fabs(height - bounds.Height) > height / 85.0)
- {
- /* further testing is useless */
- GdipDeleteGraphics(graphics);
- continue;
- }
expectf_(height, bounds.Height, height / 85.0);
expectf_(bounds.Height / base_cy, bounds.Width / base_cx, 0.05);
expect(7, chars);
--
1.7.11.4
More information about the wine-patches
mailing list