d2d1: Don't update device context DPI values when changing targets.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
44a3be9177
commit
9a808acbd5
|
@ -1940,9 +1940,7 @@ static void d2d_device_context_reset_target(struct d2d_device_context *context)
|
|||
ID2D1Bitmap1_Release(&context->target->ID2D1Bitmap1_iface);
|
||||
context->target = NULL;
|
||||
|
||||
context->desc.dpiX = 96.0f;
|
||||
context->desc.dpiY = 96.0f;
|
||||
|
||||
/* Note that DPI settings are kept. */
|
||||
memset(&context->desc.pixelFormat, 0, sizeof(context->desc.pixelFormat));
|
||||
memset(&context->pixel_size, 0, sizeof(context->pixel_size));
|
||||
|
||||
|
@ -1983,8 +1981,6 @@ static void STDMETHODCALLTYPE d2d_device_context_SetTarget(ID2D1DeviceContext *i
|
|||
d2d_device_context_reset_target(context);
|
||||
|
||||
/* Set sizes and pixel format. */
|
||||
context->desc.dpiX = bitmap_impl->dpi_x;
|
||||
context->desc.dpiY = bitmap_impl->dpi_y;
|
||||
context->pixel_size = bitmap_impl->pixel_size;
|
||||
context->desc.pixelFormat = bitmap_impl->format;
|
||||
context->target = bitmap_impl;
|
||||
|
@ -3771,6 +3767,8 @@ HRESULT d2d_d3d_create_render_target(ID2D1Device *device, IDXGISurface *surface,
|
|||
return hr;
|
||||
}
|
||||
|
||||
ID2D1DeviceContext_SetDpi(&object->ID2D1DeviceContext_iface, bitmap_desc.dpiX, bitmap_desc.dpiY);
|
||||
|
||||
if (surface)
|
||||
{
|
||||
bitmap_desc.pixelFormat = desc->pixelFormat;
|
||||
|
|
|
@ -8137,8 +8137,8 @@ static void test_dpi(void)
|
|||
|
||||
/* Device context DPI values aren't updated by SetTarget. */
|
||||
ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
|
||||
todo_wine ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
|
||||
todo_wine ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
|
||||
ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
|
||||
ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
|
||||
|
||||
ID2D1Bitmap1_Release(bitmap);
|
||||
}
|
||||
|
@ -8203,8 +8203,8 @@ static void test_dpi(void)
|
|||
|
||||
/* Device context DPI values aren't updated by SetTarget. */
|
||||
ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
|
||||
todo_wine ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
|
||||
todo_wine ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
|
||||
ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
|
||||
ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
|
||||
|
||||
ID2D1Bitmap1_Release(bitmap);
|
||||
}
|
||||
|
@ -8258,16 +8258,16 @@ static void test_dpi(void)
|
|||
|
||||
/* Device context DPI values aren't updated by SetTarget. */
|
||||
ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
|
||||
todo_wine ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
|
||||
todo_wine ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
|
||||
ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
|
||||
ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
|
||||
|
||||
ID2D1Bitmap1_Release(bitmap);
|
||||
}
|
||||
|
||||
ID2D1DeviceContext_SetTarget(device_context, NULL);
|
||||
ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
|
||||
todo_wine ok(dpi_x == dc_dpi_x, "Got unexpected dpi_x %.8e, expected %.8e.\n", dpi_x, dc_dpi_x);
|
||||
todo_wine ok(dpi_y == dc_dpi_y, "Got unexpected dpi_y %.8e, expected %.8e.\n", dpi_y, dc_dpi_y);
|
||||
ok(dpi_x == dc_dpi_x, "Got unexpected dpi_x %.8e, expected %.8e.\n", dpi_x, dc_dpi_x);
|
||||
ok(dpi_y == dc_dpi_y, "Got unexpected dpi_y %.8e, expected %.8e.\n", dpi_y, dc_dpi_y);
|
||||
|
||||
ID2D1DeviceContext_Release(device_context);
|
||||
IDXGISurface_Release(surface);
|
||||
|
|
Loading…
Reference in New Issue