[PATCH v2 0/2] MR9312: d2d1: Add support for using IWICBitmapLock with CreateSharedBitmap()
I found this deficiency while trying to run Paint.NET v4.0. -- v2: d2d1: Add support for using IWICBitmapLock with CreateSharedBitmap() d2d1/tests: Add a test for using IWICBitmapLock with CreateSharedBitmap() https://gitlab.winehq.org/wine/wine/-/merge_requests/9312
From: Jason Wendt <jason.wendt(a)gmail.com> --- dlls/d2d1/tests/d2d1.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 7333f24eab9..4478af7e11e 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -5271,6 +5271,7 @@ static void test_alpha_mode(BOOL d3d11) static void test_shared_bitmap(BOOL d3d11) { IWICBitmap *wic_bitmap1, *wic_bitmap2; + IWICBitmapLock *wic_lock; ID2D1GdiInteropRenderTarget *interop; D2D1_RENDER_TARGET_PROPERTIES desc; D2D1_BITMAP_PROPERTIES bitmap_desc; @@ -5411,6 +5412,18 @@ static void test_shared_bitmap(BOOL d3d11) ID2D1Bitmap_Release(bitmap2); ID2D1RenderTarget_Release(rt2); + /* Software rendered render target for IWICBitmapLock */ + desc.type = D2D1_RENDER_TARGET_TYPE_SOFTWARE; + hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory1, surface2, &desc, &rt2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IWICBitmap_Lock(wic_bitmap1, NULL, WICBitmapLockRead, &wic_lock); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_IWICBitmapLock, wic_bitmap1, NULL, &bitmap2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + IWICBitmapLock_Release(wic_lock); + ID2D1Bitmap_Release(bitmap2); + ID2D1RenderTarget_Release(rt2); + /* Shared DXGI surface. */ desc.type = D2D1_RENDER_TARGET_TYPE_DEFAULT; desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9312
From: Jason Wendt <jason.wendt(a)gmail.com> --- dlls/d2d1/bitmap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c index c6ab60c1bc4..e67d51286b2 100644 --- a/dlls/d2d1/bitmap.c +++ b/dlls/d2d1/bitmap.c @@ -680,6 +680,11 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, return S_OK; } + if (IsEqualGUID(iid, &IID_IWICBitmapLock)) + { + return d2d_bitmap_create_from_wic_bitmap(context, data, desc, bitmap); + } + WARN("Unhandled interface %s.\n", debugstr_guid(iid)); return E_INVALIDARG; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9312
This is obviously broken, the test crashes on Windows. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9312#note_121222
This merge request was closed by Jason Wendt. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9312
Submitted some tests !9407. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9312#note_121274
participants (3)
-
Jason Wendt -
Jason Wendt (@jason.wendt) -
Nikolay Sivov (@nsivov)