From 4e734f48eb07c3d981829fc04d081b67feca9ed4 Mon Sep 17 00:00:00 2001 From: Vladislav Timonin Date: Sat, 29 Oct 2022 17:28:57 +0700 Subject: [PATCH] d2d1: Implement ID2D1Device1::CreateDeviceContext. --- dlls/d2d1/device.c | 21 +++++++++++++-------- dlls/d2d1/tests/d2d1.c | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index ed7b43e05da..72781a48d10 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -4534,14 +4534,11 @@ static void WINAPI d2d_device_GetFactory(ID2D1Device1 *iface, ID2D1Factory **fac ID2D1Factory1_AddRef(device->factory); } -static HRESULT WINAPI d2d_device_CreateDeviceContext(ID2D1Device1 *iface, D2D1_DEVICE_CONTEXT_OPTIONS options, - ID2D1DeviceContext **context) -{ +static HRESULT d2d_device_create_device_context(ID2D1Device1 *iface, D2D1_DEVICE_CONTEXT_OPTIONS options, + ID2D1DeviceContext1 **context) { struct d2d_device_context *object; HRESULT hr; - TRACE("iface %p, options %#x, context %p.\n", iface, options, context); - if (options) FIXME("Options are ignored %#x.\n", options); @@ -4556,11 +4553,19 @@ static HRESULT WINAPI d2d_device_CreateDeviceContext(ID2D1Device1 *iface, D2D1_D } TRACE("Created device context %p.\n", object); - *context = (ID2D1DeviceContext *)&object->ID2D1DeviceContext1_iface; + *context = &object->ID2D1DeviceContext1_iface; return S_OK; } +static HRESULT WINAPI d2d_device_CreateDeviceContext(ID2D1Device1 *iface, D2D1_DEVICE_CONTEXT_OPTIONS options, + ID2D1DeviceContext **context) +{ + TRACE("iface %p, options %#x, context %p.\n", iface, options, context); + + return d2d_device_create_device_context(iface, options, (ID2D1DeviceContext1 **)context); +} + static HRESULT WINAPI d2d_device_CreatePrintControl(ID2D1Device1 *iface, IWICImagingFactory *wic_factory, IPrintDocumentPackageTarget *document_target, const D2D1_PRINT_CONTROL_PROPERTIES *desc, ID2D1PrintControl **print_control) @@ -4605,9 +4610,9 @@ static void WINAPI d2d_device_SetRenderingPriority(ID2D1Device1 *iface, D2D1_REN static HRESULT WINAPI d2d_device_CreateDeviceContext1(ID2D1Device1 *iface, D2D1_DEVICE_CONTEXT_OPTIONS options, ID2D1DeviceContext1 **context) { - FIXME("iface %p, options %#x, context %p.\n", iface, options, context); + TRACE("iface %p, options %#x, context %p.\n", iface, options, context); - return E_NOTIMPL; + return d2d_device_create_device_context(iface, options, context); } static const struct ID2D1Device1Vtbl d2d_device_vtbl = diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 7560e44409e..99a1013a333 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9199,9 +9199,9 @@ static void test_device_context(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID2D1Device1_CreateDeviceContext(device1, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &device_context1); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - if (hr == S_OK) ID2D1DeviceContext1_Release(device_context1); + ID2D1DeviceContext1_Release(device_context1); ID2D1Device1_Release(device1); }