From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/d2d1/d2d1.spec | 2 +- dlls/d2d1/factory.c | 22 ++++++++++++++++++++++ include/d2d1_1.idl | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/d2d1/d2d1.spec b/dlls/d2d1/d2d1.spec index b44d7114044..693f2828c74 100644 --- a/dlls/d2d1/d2d1.spec +++ b/dlls/d2d1/d2d1.spec @@ -5,7 +5,7 @@ @ stdcall D2D1InvertMatrix(ptr) @ stdcall D2D1ConvertColorSpace(long long ptr) @ stdcall D2D1CreateDevice(ptr ptr ptr) -@ stub D2D1CreateDeviceContext +@ stdcall D2D1CreateDeviceContext(ptr ptr ptr) @ stdcall D2D1SinCos(float ptr ptr) @ stdcall D2D1Tan(float) @ stdcall D2D1Vec3Length(float float float) diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c index 62cbeeb51dd..80c147638cd 100644 --- a/dlls/d2d1/factory.c +++ b/dlls/d2d1/factory.c @@ -1510,6 +1510,28 @@ HRESULT WINAPI D2D1CreateDevice(IDXGIDevice *dxgi_device, return hr; }
+HRESULT WINAPI D2D1CreateDeviceContext(IDXGISurface *dxgi_surface, + const D2D1_CREATION_PROPERTIES *properties, ID2D1DeviceContext **context) +{ + IDXGIDevice *dxgi_device; + ID2D1Device *device; + HRESULT hr; + + TRACE("dxgi_surface %p, properties %p, context %p.\n", dxgi_surface, properties, context); + + if (FAILED(hr = IDXGISurface_GetDevice(dxgi_surface, &IID_IDXGIDevice, (void **)&dxgi_device))) + return hr; + + if (SUCCEEDED(hr = D2D1CreateDevice(dxgi_device, properties, &device))) + { + hr = ID2D1Device_CreateDeviceContext(device, properties ? properties->options : D2D1_DEVICE_CONTEXT_OPTIONS_NONE, context); + ID2D1Device_Release(device); + } + + IDXGIDevice_Release(dxgi_device); + return hr; +} + void WINAPI D2D1SinCos(float angle, float *s, float *c) { TRACE("angle %.8e, s %p, c %p.\n", angle, s, c); diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl index 5560f24a38e..ea46fa956eb 100644 --- a/include/d2d1_1.idl +++ b/include/d2d1_1.idl @@ -976,6 +976,8 @@ interface ID2D1Multithread : IUnknown
[local] HRESULT __stdcall D2D1CreateDevice(IDXGIDevice *dxgi_device, const D2D1_CREATION_PROPERTIES *creation_properties, ID2D1Device **device); +[local] HRESULT __stdcall D2D1CreateDeviceContext(IDXGISurface *dxgi_surface, + const D2D1_CREATION_PROPERTIES *creation_properties, ID2D1DeviceContext **context); [local] void __stdcall D2D1SinCos(float angle, float *s, float *c); [local] float __stdcall D2D1Tan(float angle); [local] float __stdcall D2D1Vec3Length(float x, float y, float z);