From: Vladislav Timonin timoninvlad@yandex.ru
--- dlls/d2d1/device.c | 39 +++++++++++++++++++++++++++++++-------- dlls/d2d1/tests/d2d1.c | 4 ++-- 2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 3347514bb21..ae5247a79da 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,7 +4553,24 @@ 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) +{ + ID2D1DeviceContext1 *context1 = NULL; + HRESULT hr; + + TRACE("iface %p, options %#x, context %p.\n", iface, options, context); + + if (FAILED(hr = d2d_device_create_device_context(iface, options, &context1))) { + return hr; + } + + *context = (ID2D1DeviceContext *)context1;
return S_OK; } @@ -4605,9 +4619,18 @@ 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); + ID2D1DeviceContext1 *context1 = NULL; + HRESULT hr;
- return E_NOTIMPL; + TRACE("iface %p, options %#x, context %p.\n", iface, options, context); + + if (FAILED(hr = d2d_device_create_device_context(iface, options, &context1))) { + return hr; + } + + *context = context1; + + return S_OK; }
static const struct ID2D1Device1Vtbl d2d_device_vtbl = diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 172dd0e8140..e7860cb4bf4 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9198,9 +9198,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); }