From: Akihiro Sagawa sagawa.aki@gmail.com
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- This supersedes patch 171798.
dlls/d2d1/device.c | 8 +++----- dlls/d2d1/tests/d2d1.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 98f06a281a9..64b3041b2cf 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -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; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index d6b5055ed3d..a71477be3b4 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -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);