Hi Nikolay,
On 12.02.2017 20:14, Nikolay Sivov wrote:
diff --git a/dlls/d2d1/bitmap_render_target.c b/dlls/d2d1/bitmap_render_target.c index 67b0713376..3ac5c77d36 100644 --- a/dlls/d2d1/bitmap_render_target.c +++ b/dlls/d2d1/bitmap_render_target.c @@ -32,6 +32,8 @@ static inline struct d2d_bitmap_render_target *impl_from_ID2D1BitmapRenderTarget static HRESULT STDMETHODCALLTYPE d2d_bitmap_render_target_QueryInterface(ID2D1BitmapRenderTarget *iface, REFIID iid, void **out) {
struct d2d_bitmap_render_target *render_target = impl_from_ID2D1BitmapRenderTarget(iface);
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_ID2D1BitmapRenderTarget)
@@ -43,6 +45,8 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_render_target_QueryInterface(ID2D1Bi *out = iface; return S_OK; }
- else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget))
return ID2D1RenderTarget_QueryInterface(render_target->dxgi_target, iid, out);
AFAICS this won't work. If you call QueryInterface(IID_ID2D1BitmapRenderTarget) on returned ID2D1GdiInteropRenderTarget, it will fail. There are a few solutions for that. The most generic is COM aggregation with separated 'inner' IUnknown for dxgi_target.
Thanks,
Jacek
On 13.02.2017 16:08, Jacek Caban wrote:
Hi Nikolay,
On 12.02.2017 20:14, Nikolay Sivov wrote:
diff --git a/dlls/d2d1/bitmap_render_target.c b/dlls/d2d1/bitmap_render_target.c index 67b0713376..3ac5c77d36 100644 --- a/dlls/d2d1/bitmap_render_target.c +++ b/dlls/d2d1/bitmap_render_target.c @@ -32,6 +32,8 @@ static inline struct d2d_bitmap_render_target *impl_from_ID2D1BitmapRenderTarget static HRESULT STDMETHODCALLTYPE d2d_bitmap_render_target_QueryInterface(ID2D1BitmapRenderTarget *iface, REFIID iid, void **out) {
struct d2d_bitmap_render_target *render_target = impl_from_ID2D1BitmapRenderTarget(iface);
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_ID2D1BitmapRenderTarget)
@@ -43,6 +45,8 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_render_target_QueryInterface(ID2D1Bi *out = iface; return S_OK; }
- else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget))
return ID2D1RenderTarget_QueryInterface(render_target->dxgi_target, iid, out);
AFAICS this won't work. If you call QueryInterface(IID_ID2D1BitmapRenderTarget) on returned ID2D1GdiInteropRenderTarget, it will fail. There are a few solutions for that. The most generic is COM aggregation with separated 'inner' IUnknown for dxgi_target.
You're right, I only need it work one way so far, and I don't have tests to show it has to work both ways, which is admittedly an expected behaviour. Actually aggregation is something I'd like to avoid, I'd rather duplicate it for every target, simply forwarding these two methods.
Thanks,
Jacek