Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d2d1/bitmap_render_target.c | 2 +-
dlls/d2d1/d2d1_private.h | 9 ++++++-
dlls/d2d1/dc_render_target.c | 41 +++++++++++++++++-------------
dlls/d2d1/device.c | 36 ++++++++++++++++++--------
dlls/d2d1/factory.c | 2 +-
dlls/d2d1/hwnd_render_target.c | 32 ++++++++++++++----------
dlls/d2d1/wic_render_target.c | 43 +++++++++++++++++++-------------
7 files changed, 104 insertions(+), 61 deletions(-)
diff --git a/dlls/d2d1/bitmap_render_target.c b/dlls/d2d1/bitmap_render_target.c
index c106e211d6..004dd2ed47 100644
--- a/dlls/d2d1/bitmap_render_target.c
+++ b/dlls/d2d1/bitmap_render_target.c
@@ -811,7 +811,7 @@ HRESULT d2d_bitmap_render_target_init(struct d2d_bitmap_render_target *render_ta
}
if (FAILED(hr = d2d_d3d_create_render_target(parent_target->factory, dxgi_surface,
- (IUnknown *)&render_target->ID2D1BitmapRenderTarget_iface, &dxgi_rt_desc, &render_target->dxgi_target)))
+ (IUnknown *)&render_target->ID2D1BitmapRenderTarget_iface, NULL, &dxgi_rt_desc, &render_target->dxgi_target)))
{
WARN("Failed to create DXGI surface render target, hr %#x.\n", hr);
IDXGISurface_Release(dxgi_surface);
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index e00b942797..aa078ed39c 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -117,6 +117,11 @@ struct d2d_ps_cb
struct d2d_brush_cb opacity_brush;
};
+struct d2d_device_context_ops
+{
+ HRESULT (*device_context_present)(IUnknown *outer_unknown);
+};
+
struct d2d_device_context
{
ID2D1DeviceContext ID2D1DeviceContext_iface;
@@ -125,6 +130,7 @@ struct d2d_device_context
LONG refcount;
IUnknown *outer_unknown;
+ const struct d2d_device_context_ops *ops;
ID2D1Factory *factory;
ID3D10Device *device;
@@ -149,7 +155,8 @@ struct d2d_device_context
};
HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surface, IUnknown *outer_unknown,
- const D2D1_RENDER_TARGET_PROPERTIES *desc, ID2D1RenderTarget **render_target) DECLSPEC_HIDDEN;
+ const struct d2d_device_context_ops *ops, 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;
struct d2d_wic_render_target
diff --git a/dlls/d2d1/dc_render_target.c b/dlls/d2d1/dc_render_target.c
index d5e4f47e6d..8e97e99b5d 100644
--- a/dlls/d2d1/dc_render_target.c
+++ b/dlls/d2d1/dc_render_target.c
@@ -24,17 +24,26 @@
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
-static void sync_bitmap(struct d2d_dc_render_target *render_target)
+static inline struct d2d_dc_render_target *impl_from_IUnknown(IUnknown *iface)
{
+ return CONTAINING_RECORD(iface, struct d2d_dc_render_target, ID2D1DCRenderTarget_iface);
+}
+
+static HRESULT d2d_dc_render_target_present(IUnknown *outer_unknown)
+{
+ struct d2d_dc_render_target *render_target = impl_from_IUnknown(outer_unknown);
const RECT *dst_rect = &render_target->dst_rect;
RECT empty_rect;
HDC src_hdc;
HRESULT hr;
+ if (!render_target->hdc)
+ return D2DERR_WRONG_STATE;
+
if (FAILED(hr = IDXGISurface1_GetDC(render_target->dxgi_surface, FALSE, &src_hdc)))
{
WARN("GetDC() failed, %#x.\n", hr);
- return;
+ return S_OK;
}
BitBlt(render_target->hdc, dst_rect->left, dst_rect->top, dst_rect->right - dst_rect->left,
@@ -42,6 +51,8 @@ static void sync_bitmap(struct d2d_dc_render_target *render_target)
SetRectEmpty(&empty_rect);
IDXGISurface1_ReleaseDC(render_target->dxgi_surface, &empty_rect);
+
+ return S_OK;
}
static inline struct d2d_dc_render_target *impl_from_ID2D1DCRenderTarget(ID2D1DCRenderTarget *iface)
@@ -64,7 +75,8 @@ static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_QueryInterface(ID2D1DCRend
*out = iface;
return S_OK;
}
- else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget))
+ else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget)
+ || IsEqualGUID(iid, &IID_ID2D1DeviceContext))
return ID2D1RenderTarget_QueryInterface(render_target->dxgi_target, iid, out);
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
@@ -524,14 +536,10 @@ static void STDMETHODCALLTYPE d2d_dc_render_target_PopLayer(ID2D1DCRenderTarget
static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_Flush(ID2D1DCRenderTarget *iface, D2D1_TAG *tag1, D2D1_TAG *tag2)
{
struct d2d_dc_render_target *render_target = impl_from_ID2D1DCRenderTarget(iface);
- HRESULT hr;
TRACE("iface %p, tag1 %p, tag2 %p.\n", iface, tag1, tag2);
- hr = ID2D1RenderTarget_Flush(render_target->dxgi_target, tag1, tag2);
- sync_bitmap(render_target);
-
- return hr;
+ return ID2D1RenderTarget_Flush(render_target->dxgi_target, tag1, tag2);
}
static void STDMETHODCALLTYPE d2d_dc_render_target_SaveDrawingState(ID2D1DCRenderTarget *iface,
@@ -595,17 +603,10 @@ static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_EndDraw(ID2D1DCRenderTarge
D2D1_TAG *tag1, D2D1_TAG *tag2)
{
struct d2d_dc_render_target *render_target = impl_from_ID2D1DCRenderTarget(iface);
- HRESULT hr;
TRACE("iface %p, tag1 %p, tag2 %p.\n", iface, tag1, tag2);
- if (!render_target->hdc)
- return D2DERR_WRONG_STATE;
-
- hr = ID2D1RenderTarget_EndDraw(render_target->dxgi_target, tag1, tag2);
- sync_bitmap(render_target);
-
- return hr;
+ return ID2D1RenderTarget_EndDraw(render_target->dxgi_target, tag1, tag2);
}
static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_dc_render_target_GetPixelFormat(ID2D1DCRenderTarget *iface,
@@ -813,6 +814,11 @@ static const struct ID2D1DCRenderTargetVtbl d2d_dc_render_target_vtbl =
d2d_dc_render_target_BindDC,
};
+static const struct d2d_device_context_ops d2d_dc_render_target_ops =
+{
+ d2d_dc_render_target_present,
+};
+
HRESULT d2d_dc_render_target_init(struct d2d_dc_render_target *render_target, ID2D1Factory *factory,
ID3D10Device1 *device, const D2D1_RENDER_TARGET_PROPERTIES *desc)
{
@@ -868,7 +874,8 @@ HRESULT d2d_dc_render_target_init(struct d2d_dc_render_target *render_target, ID
}
if (FAILED(hr = d2d_d3d_create_render_target(factory, (IDXGISurface *)render_target->dxgi_surface,
- (IUnknown *)&render_target->ID2D1DCRenderTarget_iface, desc, &render_target->dxgi_target)))
+ (IUnknown *)&render_target->ID2D1DCRenderTarget_iface, &d2d_dc_render_target_ops,
+ desc, &render_target->dxgi_target)))
{
WARN("Failed to create DXGI surface render target, hr %#x.\n", hr);
IDXGISurface1_Release(render_target->dxgi_surface);
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index bba4870dd4..dd33866c9f 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -205,7 +205,7 @@ static inline struct d2d_device_context *impl_from_ID2D1RenderTarget(ID2D1Render
static HRESULT STDMETHODCALLTYPE d2d_device_context_QueryInterface(ID2D1DeviceContext *iface, REFIID iid, void **out)
{
- struct d2d_device_context *render_target = impl_from_ID2D1DeviceContext(iface);
+ struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
@@ -220,10 +220,12 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_QueryInterface(ID2D1DeviceCo
}
else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget))
{
- ID2D1GdiInteropRenderTarget_AddRef(&render_target->ID2D1GdiInteropRenderTarget_iface);
- *out = &render_target->ID2D1GdiInteropRenderTarget_iface;
+ ID2D1GdiInteropRenderTarget_AddRef(&context->ID2D1GdiInteropRenderTarget_iface);
+ *out = &context->ID2D1GdiInteropRenderTarget_iface;
return S_OK;
}
+ else if (context->outer_unknown)
+ return IUnknown_QueryInterface(context->outer_unknown, iid, out);
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
@@ -1448,8 +1450,13 @@ static void STDMETHODCALLTYPE d2d_device_context_PopLayer(ID2D1DeviceContext *if
static HRESULT STDMETHODCALLTYPE d2d_device_context_Flush(ID2D1DeviceContext *iface, D2D1_TAG *tag1, D2D1_TAG *tag2)
{
+ struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
+
FIXME("iface %p, tag1 %p, tag2 %p stub!\n", iface, tag1, tag2);
+ if (context->ops)
+ context->ops->device_context_present(context->outer_unknown);
+
return E_NOTIMPL;
}
@@ -1615,16 +1622,23 @@ static void STDMETHODCALLTYPE d2d_device_context_BeginDraw(ID2D1DeviceContext *i
static HRESULT STDMETHODCALLTYPE d2d_device_context_EndDraw(ID2D1DeviceContext *iface,
D2D1_TAG *tag1, D2D1_TAG *tag2)
{
- struct d2d_device_context *render_target = impl_from_ID2D1DeviceContext(iface);
+ struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
+ HRESULT hr;
TRACE("iface %p, tag1 %p, tag2 %p.\n", iface, tag1, tag2);
if (tag1)
- *tag1 = render_target->error.tag1;
+ *tag1 = context->error.tag1;
if (tag2)
- *tag2 = render_target->error.tag2;
+ *tag2 = context->error.tag2;
- return render_target->error.code;
+ if (context->ops)
+ {
+ if (FAILED(hr = context->ops->device_context_present(context->outer_unknown)))
+ context->error.code = hr;
+ }
+
+ return context->error.code;
}
static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_device_context_GetPixelFormat(ID2D1DeviceContext *iface,
@@ -2469,7 +2483,8 @@ static const struct ID2D1GdiInteropRenderTargetVtbl d2d_gdi_interop_render_targe
};
static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, ID2D1Factory *factory,
- IDXGISurface *surface, IUnknown *outer_unknown, const D2D1_RENDER_TARGET_PROPERTIES *desc)
+ IDXGISurface *surface, IUnknown *outer_unknown, const struct d2d_device_context_ops *ops,
+ const D2D1_RENDER_TARGET_PROPERTIES *desc)
{
D3D10_SUBRESOURCE_DATA buffer_data;
D3D10_STATE_BLOCK_MASK state_mask;
@@ -3357,6 +3372,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target,
render_target->outer_unknown = outer_unknown ? outer_unknown :
(IUnknown *)&render_target->ID2D1DeviceContext_iface;
+ render_target->ops = ops;
if (FAILED(hr = IDXGISurface_GetDevice(surface, &IID_ID3D10Device, (void **)&render_target->device)))
{
@@ -3555,7 +3571,7 @@ err:
}
HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surface, IUnknown *outer_unknown,
- const D2D1_RENDER_TARGET_PROPERTIES *desc, ID2D1RenderTarget **render_target)
+ const struct d2d_device_context_ops *ops, const D2D1_RENDER_TARGET_PROPERTIES *desc, ID2D1RenderTarget **render_target)
{
struct d2d_device_context *object;
HRESULT hr;
@@ -3563,7 +3579,7 @@ HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surfac
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- if (FAILED(hr = d2d_device_context_init(object, factory, surface, outer_unknown, desc)))
+ if (FAILED(hr = d2d_device_context_init(object, factory, surface, outer_unknown, ops, desc)))
{
WARN("Failed to initialize render target, hr %#x.\n", hr);
heap_free(object);
diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index d2e53879e6..386734d26f 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -340,7 +340,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDxgiSurfaceRenderTarget(ID2D1
{
TRACE("iface %p, surface %p, desc %p, render_target %p.\n", iface, surface, desc, render_target);
- return d2d_d3d_create_render_target((ID2D1Factory *)iface, surface, NULL, desc, render_target);
+ return d2d_d3d_create_render_target((ID2D1Factory *)iface, surface, NULL, NULL, desc, render_target);
}
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDCRenderTarget(ID2D1Factory1 *iface,
diff --git a/dlls/d2d1/hwnd_render_target.c b/dlls/d2d1/hwnd_render_target.c
index 04d33536a6..976b926efa 100644
--- a/dlls/d2d1/hwnd_render_target.c
+++ b/dlls/d2d1/hwnd_render_target.c
@@ -24,12 +24,20 @@
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
-static void render_target_present(struct d2d_hwnd_render_target *render_target)
+static inline struct d2d_hwnd_render_target *impl_from_IUnknown(IUnknown *iface)
{
+ return CONTAINING_RECORD(iface, struct d2d_hwnd_render_target, ID2D1HwndRenderTarget_iface);
+}
+
+static HRESULT d2d_hwnd_render_target_present(IUnknown *outer_unknown)
+{
+ struct d2d_hwnd_render_target *render_target = impl_from_IUnknown(outer_unknown);
HRESULT hr;
if (FAILED(hr = IDXGISwapChain_Present(render_target->swapchain, render_target->sync_interval, 0)))
WARN("Present failed, %#x.\n", hr);
+
+ return S_OK;
}
static inline struct d2d_hwnd_render_target *impl_from_ID2D1HwndRenderTarget(ID2D1HwndRenderTarget *iface)
@@ -53,7 +61,8 @@ static HRESULT STDMETHODCALLTYPE d2d_hwnd_render_target_QueryInterface(ID2D1Hwnd
*out = iface;
return S_OK;
}
- else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget))
+ else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget)
+ || IsEqualGUID(iid, &IID_ID2D1DeviceContext))
return ID2D1RenderTarget_QueryInterface(render_target->dxgi_target, iid, out);
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
@@ -516,14 +525,10 @@ static HRESULT STDMETHODCALLTYPE d2d_hwnd_render_target_Flush(ID2D1HwndRenderTar
D2D1_TAG *tag2)
{
struct d2d_hwnd_render_target *render_target = impl_from_ID2D1HwndRenderTarget(iface);
- HRESULT hr;
TRACE("iface %p, tag1 %p, tag2 %p.\n", iface, tag1, tag2);
- hr = ID2D1RenderTarget_Flush(render_target->dxgi_target, tag1, tag2);
- render_target_present(render_target);
-
- return hr;
+ return ID2D1RenderTarget_Flush(render_target->dxgi_target, tag1, tag2);
}
static void STDMETHODCALLTYPE d2d_hwnd_render_target_SaveDrawingState(ID2D1HwndRenderTarget *iface,
@@ -587,14 +592,10 @@ static HRESULT STDMETHODCALLTYPE d2d_hwnd_render_target_EndDraw(ID2D1HwndRenderT
D2D1_TAG *tag1, D2D1_TAG *tag2)
{
struct d2d_hwnd_render_target *render_target = impl_from_ID2D1HwndRenderTarget(iface);
- HRESULT hr;
TRACE("iface %p, tag1 %p, tag2 %p.\n", iface, tag1, tag2);
- hr = ID2D1RenderTarget_EndDraw(render_target->dxgi_target, tag1, tag2);
- render_target_present(render_target);
-
- return hr;
+ return ID2D1RenderTarget_EndDraw(render_target->dxgi_target, tag1, tag2);
}
static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_hwnd_render_target_GetPixelFormat(ID2D1HwndRenderTarget *iface,
@@ -776,6 +777,11 @@ static const struct ID2D1HwndRenderTargetVtbl d2d_hwnd_render_target_vtbl =
d2d_hwnd_render_target_GetHwnd
};
+static const struct d2d_device_context_ops d2d_hwnd_render_target_ops =
+{
+ d2d_hwnd_render_target_present,
+};
+
HRESULT d2d_hwnd_render_target_init(struct d2d_hwnd_render_target *render_target, ID2D1Factory *factory,
ID3D10Device1 *device, const D2D1_RENDER_TARGET_PROPERTIES *desc,
const D2D1_HWND_RENDER_TARGET_PROPERTIES *hwnd_rt_desc)
@@ -862,7 +868,7 @@ HRESULT d2d_hwnd_render_target_init(struct d2d_hwnd_render_target *render_target
render_target->ID2D1HwndRenderTarget_iface.lpVtbl = &d2d_hwnd_render_target_vtbl;
hr = d2d_d3d_create_render_target(factory, dxgi_surface, (IUnknown *)&render_target->ID2D1HwndRenderTarget_iface,
- &dxgi_rt_desc, &render_target->dxgi_target);
+ &d2d_hwnd_render_target_ops, &dxgi_rt_desc, &render_target->dxgi_target);
IDXGISurface_Release(dxgi_surface);
if (FAILED(hr))
{
diff --git a/dlls/d2d1/wic_render_target.c b/dlls/d2d1/wic_render_target.c
index 5642fd44ff..67a826f8ae 100644
--- a/dlls/d2d1/wic_render_target.c
+++ b/dlls/d2d1/wic_render_target.c
@@ -25,8 +25,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
-static void sync_bitmap(struct d2d_wic_render_target *render_target)
+static inline struct d2d_wic_render_target *impl_from_IUnknown(IUnknown *iface)
{
+ return CONTAINING_RECORD(iface, struct d2d_wic_render_target, ID2D1RenderTarget_iface);
+}
+
+static HRESULT d2d_wic_render_target_present(IUnknown *outer_unknown)
+{
+ struct d2d_wic_render_target *render_target = impl_from_IUnknown(outer_unknown);
D3D10_MAPPED_TEXTURE2D mapped_texture;
ID3D10Resource *src_resource;
IWICBitmapLock *bitmap_lock;
@@ -41,7 +47,7 @@ static void sync_bitmap(struct d2d_wic_render_target *render_target)
&IID_ID3D10Resource, (void **)&src_resource)))
{
ERR("Failed to get source resource interface, hr %#x.\n", hr);
- return;
+ goto end;
}
ID3D10Texture2D_GetDevice(render_target->readback_texture, &device);
@@ -56,28 +62,28 @@ static void sync_bitmap(struct d2d_wic_render_target *render_target)
if (FAILED(hr = IWICBitmap_Lock(render_target->bitmap, &dst_rect, WICBitmapLockWrite, &bitmap_lock)))
{
ERR("Failed to lock destination bitmap, hr %#x.\n", hr);
- return;
+ goto end;
}
if (FAILED(hr = IWICBitmapLock_GetDataPointer(bitmap_lock, &dst_size, &dst)))
{
ERR("Failed to get data pointer, hr %#x.\n", hr);
IWICBitmapLock_Release(bitmap_lock);
- return;
+ goto end;
}
if (FAILED(hr = IWICBitmapLock_GetStride(bitmap_lock, &dst_pitch)))
{
ERR("Failed to get stride, hr %#x.\n", hr);
IWICBitmapLock_Release(bitmap_lock);
- return;
+ goto end;
}
if (FAILED(hr = ID3D10Texture2D_Map(render_target->readback_texture, 0, D3D10_MAP_READ, 0, &mapped_texture)))
{
ERR("Failed to map readback texture, hr %#x.\n", hr);
IWICBitmapLock_Release(bitmap_lock);
- return;
+ goto end;
}
src = mapped_texture.pData;
@@ -91,6 +97,9 @@ static void sync_bitmap(struct d2d_wic_render_target *render_target)
ID3D10Texture2D_Unmap(render_target->readback_texture, 0);
IWICBitmapLock_Release(bitmap_lock);
+
+end:
+ return S_OK;
}
static inline struct d2d_wic_render_target *impl_from_ID2D1RenderTarget(ID2D1RenderTarget *iface)
@@ -112,7 +121,8 @@ static HRESULT STDMETHODCALLTYPE d2d_wic_render_target_QueryInterface(ID2D1Rende
*out = iface;
return S_OK;
}
- else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget))
+ else if (IsEqualGUID(iid, &IID_ID2D1GdiInteropRenderTarget)
+ || IsEqualGUID(iid, &IID_ID2D1DeviceContext))
return ID2D1RenderTarget_QueryInterface(render_target->dxgi_target, iid, out);
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
@@ -574,14 +584,10 @@ static void STDMETHODCALLTYPE d2d_wic_render_target_PopLayer(ID2D1RenderTarget *
static HRESULT STDMETHODCALLTYPE d2d_wic_render_target_Flush(ID2D1RenderTarget *iface, D2D1_TAG *tag1, D2D1_TAG *tag2)
{
struct d2d_wic_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
- HRESULT hr;
TRACE("iface %p, tag1 %p, tag2 %p.\n", iface, tag1, tag2);
- hr = ID2D1RenderTarget_Flush(render_target->dxgi_target, tag1, tag2);
- sync_bitmap(render_target);
-
- return hr;
+ return ID2D1RenderTarget_Flush(render_target->dxgi_target, tag1, tag2);
}
static void STDMETHODCALLTYPE d2d_wic_render_target_SaveDrawingState(ID2D1RenderTarget *iface,
@@ -645,14 +651,10 @@ static HRESULT STDMETHODCALLTYPE d2d_wic_render_target_EndDraw(ID2D1RenderTarget
D2D1_TAG *tag1, D2D1_TAG *tag2)
{
struct d2d_wic_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
- HRESULT hr;
TRACE("iface %p, tag1 %p, tag2 %p.\n", iface, tag1, tag2);
- hr = ID2D1RenderTarget_EndDraw(render_target->dxgi_target, tag1, tag2);
- sync_bitmap(render_target);
-
- return hr;
+ return ID2D1RenderTarget_EndDraw(render_target->dxgi_target, tag1, tag2);
}
static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_wic_render_target_GetPixelFormat(ID2D1RenderTarget *iface,
@@ -785,6 +787,11 @@ static const struct ID2D1RenderTargetVtbl d2d_wic_render_target_vtbl =
d2d_wic_render_target_IsSupported,
};
+static const struct d2d_device_context_ops d2d_wic_render_target_ops =
+{
+ d2d_wic_render_target_present,
+};
+
HRESULT d2d_wic_render_target_init(struct d2d_wic_render_target *render_target, ID2D1Factory *factory,
ID3D10Device1 *device, IWICBitmap *bitmap, const D2D1_RENDER_TARGET_PROPERTIES *desc)
{
@@ -875,7 +882,7 @@ HRESULT d2d_wic_render_target_init(struct d2d_wic_render_target *render_target,
}
if (FAILED(hr = d2d_d3d_create_render_target(factory, render_target->dxgi_surface,
- (IUnknown *)&render_target->ID2D1RenderTarget_iface, desc, &render_target->dxgi_target)))
+ (IUnknown *)&render_target->ID2D1RenderTarget_iface, &d2d_wic_render_target_ops, desc, &render_target->dxgi_target)))
{
WARN("Failed to create DXGI surface render target, hr %#x.\n", hr);
ID3D10Texture2D_Release(render_target->readback_texture);
--
2.18.0