From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/d2d1/dc_render_target.c | 10 ++++++++++ dlls/d2d1/tests/d2d1.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/d2d1/dc_render_target.c b/dlls/d2d1/dc_render_target.c index 01e1c348746..df854a53e18 100644 --- a/dlls/d2d1/dc_render_target.c +++ b/dlls/d2d1/dc_render_target.c @@ -689,6 +689,7 @@ static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_BindDC(ID2D1DCRenderTarget ID2D1DeviceContext *context; D2D1_SIZE_U bitmap_size; ID2D1Bitmap *bitmap; + HDC dst_hdc; HRESULT hr;
TRACE("iface %p, hdc %p, rect %s.\n", iface, hdc, wine_dbgstr_rect(rect)); @@ -721,6 +722,15 @@ static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_BindDC(ID2D1DCRenderTarget ID2D1Bitmap_Release(bitmap); ID2D1DeviceContext_Release(context);
+ /* Copy the DC content to the DXGI surface */ + if (FAILED(hr = IDXGISurface1_GetDC(dxgi_surface, FALSE, &dst_hdc))) + { + WARN("GetDC() failed, hr %#lx.\n", hr); + return hr; + } + BitBlt(dst_hdc, 0, 0, bitmap_size.width, bitmap_size.height, hdc, 0, 0, SRCCOPY); + IDXGISurface1_ReleaseDC(dxgi_surface, NULL); + if (render_target->dxgi_surface) IDXGISurface1_Release(render_target->dxgi_surface); render_target->dxgi_surface = dxgi_surface; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 23144f0cbac..44ec8bf94cd 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -6050,7 +6050,7 @@ static void test_dc_target(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
clr = GetPixel(hdc, 0, 0); - todo_wine ok(clr == RGB(255, 0, 0), "Got unexpected colour 0x%08lx.\n", clr); + ok(clr == RGB(255, 0, 0), "Got unexpected colour 0x%08lx.\n", clr);
DeleteDC(hdc); DeleteDC(hdc2);