[PATCH v2 2/3] d2d1: Implement ID2D1Bitmap1::Unmap().
Signed-off-by: Dmitry Timoshkov <dmitry(a)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
On 5/26/22 10:36, Dmitry Timoshkov wrote:
@@ -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) Is it necessary to unmap?
Nikolay Sivov <nsivov(a)codeweavers.com> wrote:
@@ -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) Is it necessary to unmap?
Probably not, although I was getting errors from wined3d with ::Unmap() being a stub. Perhaps that was a result of the staging texture leak. Many thanks for the helpful reviews. -- Dmitry.
participants (2)
-
Dmitry Timoshkov -
Nikolay Sivov