[PATCH resend 2/6] d2d1: Query ID3D11Resource interface in d2d_bitmap_init.
Rémi Bernon
rbernon at codeweavers.com
Mon Jun 21 02:57:44 CDT 2021
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49395
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/d2d1/bitmap.c | 7 +++++++
dlls/d2d1/d2d1_private.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index 7ed57052b98..d91b9740f2c 100644
--- a/dlls/d2d1/bitmap.c
+++ b/dlls/d2d1/bitmap.c
@@ -72,6 +72,8 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap1 *iface)
ID3D10RenderTargetView_Release(bitmap->rtv);
if (bitmap->surface)
IDXGISurface_Release(bitmap->surface);
+ if (bitmap->d3d11_resource)
+ ID3D11Resource_Release(bitmap->d3d11_resource);
ID3D10Resource_Release(bitmap->resource);
ID2D1Factory_Release(bitmap->factory);
heap_free(bitmap);
@@ -272,13 +274,18 @@ static BOOL format_supported(const D2D1_PIXEL_FORMAT *format)
static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context *context,
ID3D10Resource *resource, D2D1_SIZE_U size, const D2D1_BITMAP_PROPERTIES1 *desc)
{
+ ID3D11Resource *d3d11_resource;
ID3D10Device *d3d_device;
HRESULT hr;
+ if (FAILED(hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D11Resource, (void **)&d3d11_resource)))
+ WARN("Failed to query ID3D11Resource interface, hr %#x.\n", hr);
+
bitmap->ID2D1Bitmap1_iface.lpVtbl = &d2d_bitmap_vtbl;
bitmap->refcount = 1;
ID2D1Factory_AddRef(bitmap->factory = context->factory);
ID3D10Resource_AddRef(bitmap->resource = resource);
+ bitmap->d3d11_resource = d3d11_resource;
bitmap->pixel_size = size;
bitmap->format = desc->pixelFormat;
bitmap->dpi_x = desc->dpiX;
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index b236bf57b6f..c8b9db67f27 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -381,6 +381,7 @@ struct d2d_bitmap
ID3D10RenderTargetView *rtv;
IDXGISurface *surface;
ID3D10Resource *resource;
+ ID3D11Resource *d3d11_resource;
D2D1_SIZE_U pixel_size;
D2D1_PIXEL_FORMAT format;
float dpi_x;
--
2.31.0
More information about the wine-devel
mailing list