d2d1: SetDpi() rejects negative values too.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-01-20 21:31:58 +03:00 committed by Alexandre Julliard
parent d309b843fb
commit e2f9bc0d0b
2 changed files with 11 additions and 1 deletions

View File

@ -1439,7 +1439,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_SetDpi(ID2D1RenderTarget *if
dpi_x = 96.0f;
dpi_y = 96.0f;
}
else if (dpi_x == 0.0f || dpi_y == 0.0f)
else if (dpi_x <= 0.0f || dpi_y <= 0.0f)
return;
render_target->dpi_x = dpi_x;

View File

@ -593,6 +593,16 @@ static void test_clip(void)
ok(dpi_x == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
ok(dpi_y == 192.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
ID2D1RenderTarget_SetDpi(rt, -10.0f, 96.0f);
ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
ok(dpi_x == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
ok(dpi_y == 192.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
ID2D1RenderTarget_SetDpi(rt, 96.0f, -10.0f);
ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
ok(dpi_x == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
ok(dpi_y == 192.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
ID2D1RenderTarget_SetDpi(rt, 96.0f, 0.0f);
ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
ok(dpi_x == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);