[PATCH 2/3] d2d1: Don't update device context DPI values when changing targets.
From: Akihiro Sagawa <sagawa.aki(a)gmail.com> Signed-off-by: Akihiro Sagawa <sagawa.aki(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)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); -- 2.11.0
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=58370 Your paranoid android. === debian10 (32 bit French report) === Report errors: d2d1:d2d1 has no test summary line (early exit of the main process?) d2d1:d2d1 has unaccounted for todo messages === debian10 (build log) === X Error of failed request: GLXBadFBConfig Major opcode of failed request: 150 (GLX) Minor opcode of failed request: 34 () === debian10 (32 bit WoW report) === Report errors: d2d1:d2d1 has no test summary line (early exit of the main process?) d2d1:d2d1 has unaccounted for todo messages === debian10 (build log) === X Error of failed request: GLXBadFBConfig Major opcode of failed request: 150 (GLX) Minor opcode of failed request: 34 ()
participants (2)
-
Henri Verbeet -
Marvin