d2d1: Implement ID2D1Device1::CreateDeviceContext.

This commit is contained in:
Vladislav Timonin 2022-10-29 17:28:57 +07:00 committed by Alexandre Julliard
parent 34640a94b3
commit 4e734f48eb
2 changed files with 15 additions and 10 deletions

View file

@ -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 =

View file

@ -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);
}