Commit c05dd9e1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

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