Module: wine Branch: master Commit: bdd3f7b1eeb6f17c9da67ef4f7bf2d1c15bcf7e6 URL: https://source.winehq.org/git/wine.git/?a=commit;h=bdd3f7b1eeb6f17c9da67ef4f...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Sep 19 14:55:08 2018 +0300
d2d1: Implement CreateBitmapFromDxgiSurface().
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d2d1/device.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index d779fb0..d20377b 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -1825,9 +1825,33 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateColorContextFromWicCol static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmapFromDxgiSurface(ID2D1DeviceContext *iface, IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 *desc, ID2D1Bitmap1 **bitmap) { - FIXME("iface %p, surface %p, desc %p, bitmap %p stub!\n", iface, surface, desc, bitmap); + struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); + D2D1_BITMAP_PROPERTIES1 bitmap_desc; + struct d2d_bitmap *object; + HRESULT hr;
- return E_NOTIMPL; + TRACE("iface %p, surface %p, desc %p, bitmap %p.\n", iface, surface, desc, bitmap); + + if (!desc) + { + DXGI_SURFACE_DESC surface_desc; + + if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc))) + { + WARN("Failed to get surface desc, hr %#x.\n", hr); + return hr; + } + + memset(&bitmap_desc, 0, sizeof(bitmap_desc)); + bitmap_desc.pixelFormat.format = surface_desc.Format; + bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW; + desc = &bitmap_desc; + } + + if (SUCCEEDED(hr = d2d_bitmap_create_shared(context, &IID_IDXGISurface, surface, desc, &object))) + *bitmap = &object->ID2D1Bitmap1_iface; + + return hr; }
static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateEffect(ID2D1DeviceContext *iface,