[PATCH v2 2/2] d2d1: Implement SetUnitMode().
Ziqing Hui
zhui at codeweavers.com
Thu Apr 14 22:31:51 CDT 2022
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---
dlls/d2d1/device.c | 12 +++++++++++-
dlls/d2d1/tests/d2d1.c | 5 ++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 7bf4d6e1577..13c99458cfa 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -2149,7 +2149,17 @@ 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)
+ {
+ WARN("Unknown unit mode %#x.\n", unit_mode);
+ return;
+ }
+
+ context->drawing_state.unitMode = unit_mode;
}
static D2D1_UNIT_MODE STDMETHODCALLTYPE d2d_device_context_GetUnitMode(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,
--
2.25.1
More information about the wine-devel
mailing list