Signed-off-by: Ziqing Hui zhui@codeweavers.com --- dlls/d2d1/device.c | 15 ++++++++++++--- dlls/d2d1/tests/d2d1.c | 5 ++--- 2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 43c65ebddc1..5a0698a371a 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -2149,14 +2149,23 @@ static D2D1_PRIMITIVE_BLEND STDMETHODCALLTYPE d2d_device_context_GetPrimitiveBle
static void STDMETHODCALLTYPE d2d_device_context_SetUnitMode(ID2D1DeviceContext *iface, D2D1_UNIT_MODE unit_mode) { - FIXME("iface %p, unit_mode %#x stub!\n", iface, unit_mode); + struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); + + TRACE("iface %p, unit_mode %#x.\n", iface, unit_mode); + + if (unit_mode == D2D1_UNIT_MODE_DIPS || unit_mode == D2D1_UNIT_MODE_PIXELS) + { + context->drawing_state.unitMode = unit_mode; + } }
static D2D1_UNIT_MODE STDMETHODCALLTYPE d2d_device_context_GetUnitMode(ID2D1DeviceContext *iface) { - FIXME("iface %p stub!\n", iface); + struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
- return D2D1_UNIT_MODE_DIPS; + TRACE("iface %p.\n", iface); + + return context->drawing_state.unitMode; }
static void STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_DrawGlyphRun(ID2D1DeviceContext *iface, diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 9937d9d4a82..ca80a8e946b 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9606,11 +9606,11 @@ static void test_unit_mode(BOOL d3d11)
ID2D1DeviceContext_SetUnitMode(context, D2D1_UNIT_MODE_PIXELS); unit_mode = ID2D1DeviceContext_GetUnitMode(context); - todo_wine ok(unit_mode == D2D1_UNIT_MODE_PIXELS, "Got unexpected unit mode %#x.\n", unit_mode); + ok(unit_mode == D2D1_UNIT_MODE_PIXELS, "Got unexpected unit mode %#x.\n", unit_mode);
ID2D1DeviceContext_SetUnitMode(context, 0xdeadbeef); unit_mode = ID2D1DeviceContext_GetUnitMode(context); - todo_wine ok(unit_mode == D2D1_UNIT_MODE_PIXELS, "Got unexpected unit mode %#x.\n", unit_mode); + ok(unit_mode == D2D1_UNIT_MODE_PIXELS, "Got unexpected unit mode %#x.\n", unit_mode);
ID2D1DeviceContext_Release(context); release_test_context(&ctx); @@ -10874,7 +10874,6 @@ static void test_image_bounds(BOOL d3d11) ok(unit_mode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", unit_mode); ID2D1DeviceContext_SetUnitMode(context, D2D1_UNIT_MODE_PIXELS); ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); - todo_wine_if(!compare_float(test->dpi_x, 96.0f, 0) || !compare_float(test->dpi_y, 96.0f, 0)) ok(compare_rect(&bounds, 0.0f, 0.0f, test->pixel_size.width, test->pixel_size.height, 0), "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f,