[PATCH v2 2/3] d2d1: Implement ID2D1Bitmap1::Unmap().
Dmitry Timoshkov
dmitry at baikal.ru
Thu May 26 02:36:28 CDT 2022
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
dlls/d2d1/bitmap.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index b48c0bf2384..91594ad58a0 100644
--- a/dlls/d2d1/bitmap.c
+++ b/dlls/d2d1/bitmap.c
@@ -66,6 +66,8 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap1 *iface)
if (!refcount)
{
+ if (bitmap->staging_resource)
+ ID2D1Bitmap1_Unmap(iface);
if (bitmap->srv)
ID3D11ShaderResourceView_Release(bitmap->srv);
if (bitmap->rtv)
@@ -281,9 +283,23 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_Map(ID2D1Bitmap1 *iface, D2D1_MAP_OP
static HRESULT STDMETHODCALLTYPE d2d_bitmap_Unmap(ID2D1Bitmap1 *iface)
{
- FIXME("iface %p stub!\n", iface);
+ struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap1(iface);
+ ID3D11Device *device;
+ ID3D11DeviceContext *context;
- return E_NOTIMPL;
+ TRACE("iface %p.\n", iface);
+
+ if (!bitmap->staging_resource)
+ return D2DERR_WRONG_STATE;
+
+ ID3D11Resource_GetDevice(bitmap->resource, &device);
+ ID3D11Device_GetImmediateContext(device, &context);
+ ID3D11DeviceContext_Unmap(context, bitmap->staging_resource, 0);
+ bitmap->staging_resource = NULL;
+ ID3D11DeviceContext_Release(context);
+ ID3D11Device_Release(device);
+
+ return S_OK;
}
static const struct ID2D1Bitmap1Vtbl d2d_bitmap_vtbl =
--
2.36.1
More information about the wine-devel
mailing list