d2d1: Don't update target dpi if only one SetDpi() argument is zero.

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 00:43:33 +03:00 committed by Alexandre Julliard
parent f26e13f38f
commit c05dd9e11f
2 changed files with 15 additions and 0 deletions

View File

@ -1436,6 +1436,8 @@ 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)
return;
render_target->dpi_x = dpi_x;
render_target->dpi_y = dpi_y;

View File

@ -587,6 +587,19 @@ static void test_clip(void)
ok(dpi_x == 96.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
ok(dpi_y == 96.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
ID2D1RenderTarget_SetDpi(rt, 192.0f, 192.0f);
ID2D1RenderTarget_SetDpi(rt, 0.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, 0.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, 96.0f);
/* Transformations apply to clip rects, the effective clip rect is the
* (axis-aligned) bounding box of the transformed clip rect. */
set_point(&point, 320.0f, 240.0f);