I found this deficiency while trying to run Paint.NET v4.0.
From: Jason Wendt jason.wendt@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..e1d96ef64dd 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 == D2DERR_UNSUPPORTED_OPERATION, "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;
From: Jason Wendt jason.wendt@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;
Nikolay Sivov (@nsivov) commented about dlls/d2d1/bitmap.c:
return S_OK; }
- if (IsEqualGUID(iid, &IID_IWICBitmapLock))
- {
return d2d_bitmap_create_from_wic_bitmap(context, data, desc, bitmap);- }
I don't see how this could work, 'd2d_bitmap_create_from_wic_bitmap' expects IWICBitmapSource.
Nikolay Sivov (@nsivov) commented about dlls/d2d1/tests/d2d1.c:
ID2D1Bitmap_Release(bitmap2); ID2D1RenderTarget_Release(rt2);
- /* Software rendered render target for IWICBitmapLock */
Why does it have to be software render target?
Nikolay Sivov (@nsivov) commented about dlls/d2d1/tests/d2d1.c:
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 == D2DERR_UNSUPPORTED_OPERATION, "Got unexpected hr %#lx.\n", hr);
This test fails to create a bitmap, according to return code.
Nikolay Sivov (@nsivov) commented about dlls/d2d1/tests/d2d1.c:
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 == D2DERR_UNSUPPORTED_OPERATION, "Got unexpected hr %#lx.\n", hr);
- IWICBitmapLock_Release(wic_lock);
- ID2D1Bitmap_Release(bitmap2);
The 'bitmap2' pointer is not valid I think.