On 10 September 2018 at 19:08, Nikolay Sivov <nsivov(a)codeweavers.com> wrote:
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index e00b942797..49d1475ed4 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -117,6 +117,15 @@ struct d2d_ps_cb struct d2d_brush_cb opacity_brush; };
+typedef HRESULT (*outer_target_present_func)(const void *data); + +struct outer_target_desc +{ + IUnknown *outer_unknown; + const void *data; + outer_target_present_func present; +}; + struct d2d_device_context { ID2D1DeviceContext ID2D1DeviceContext_iface; @@ -124,7 +133,7 @@ struct d2d_device_context IDWriteTextRenderer IDWriteTextRenderer_iface; LONG refcount;
- IUnknown *outer_unknown; + struct outer_target_desc outer_target;
ID2D1Factory *factory; ID3D10Device *device; @@ -148,7 +157,7 @@ struct d2d_device_context struct d2d_clip_stack clip_stack; };
-HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surface, IUnknown *outer_unknown, +HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surface, const struct outer_target_desc *outer, const D2D1_RENDER_TARGET_PROPERTIES *desc, ID2D1RenderTarget **render_target) DECLSPEC_HIDDEN; HRESULT d2d_d3d_render_target_create_rtv(ID2D1RenderTarget *render_target, IDXGISurface1 *surface) DECLSPEC_HIDDEN;
I think "data" in struct outer_target_desc is a little redundant, I think you should be able to just pass outer_unknown to the callback. I think I'd prefer something like the following: struct d2d_device_context_ops { HRESULT (*device_context_present)(IUnknown *outer_unknown); }; HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surface, IUnknown *outer_unknown, const struct d2d_device_context_ops *ops, const D2D1_RENDER_TARGET_PROPERTIES *desc, ID2D1RenderTarget **render_target) DECLSPEC_HIDDEN; mainly for consistency with D3D code. Also, I overlooked this yesterday, but QueryInterface() on the device context interface should also support the outer interfaces.