From: Zhiyi Zhang <zzhang@codeweavers.com> React Native applications rely on d2d_device_context_Flush() returning S_OK. --- dlls/d2d1/device.c | 18 ++++++++++++++++-- dlls/d2d1/tests/d2d1.c | 15 --------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 3a23833df9a..84d2c991eda 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -1859,13 +1859,27 @@ static void STDMETHODCALLTYPE d2d_device_context_PopLayer(ID2D1DeviceContext6 *i static HRESULT STDMETHODCALLTYPE d2d_device_context_Flush(ID2D1DeviceContext6 *iface, D2D1_TAG *tag1, D2D1_TAG *tag2) { struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); + HRESULT hr; FIXME("iface %p, tag1 %p, tag2 %p stub!\n", iface, tag1, tag2); + if (tag1) + *tag1 = context->error.tag1; + if (tag2) + *tag2 = context->error.tag2; + + if (!context->is_drawing) + return D2DERR_WRONG_STATE; + if (context->ops && context->ops->device_context_present) - context->ops->device_context_present(context->outer_unknown); + { + if (FAILED(hr = context->ops->device_context_present(context->outer_unknown))) + context->error.code = hr; + } - return E_NOTIMPL; + hr = context->error.code; + d2d_device_context_set_error(context, S_OK); + return hr; } static void STDMETHODCALLTYPE d2d_device_context_SaveDrawingState(ID2D1DeviceContext6 *iface, diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 6225a3a6ebf..217775641ea 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -17850,22 +17850,16 @@ static void test_device_context_flush(BOOL d3d11) tag1 = 0xdeadbeef; tag2 = 0xdeadbeef; hr = ID2D1DeviceContext_Flush(context, &tag1, &tag2); - todo_wine ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr); - todo_wine ok(tag1 == 0, "Got unexpected tag1 %#I64x.\n", tag1); - todo_wine ok(tag2 == 0, "Got unexpected tag2 %#I64x.\n", tag2); /* Flush() doesn't clear the error code when not inside BeginDraw()/EndDraw() */ tag1 = 0xdeadbeef; tag2 = 0xdeadbeef; hr = ID2D1DeviceContext_Flush(context, &tag1, &tag2); - todo_wine ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr); - todo_wine ok(tag1 == 0, "Got unexpected tag1 %#I64x.\n", tag1); - todo_wine ok(tag2 == 0, "Got unexpected tag2 %#I64x.\n", tag2); /* Inside BeginDraw()/EndDraw() */ @@ -17874,11 +17868,8 @@ static void test_device_context_flush(BOOL d3d11) tag1 = 0xdeadbeef; tag2 = 0xdeadbeef; hr = ID2D1DeviceContext_Flush(context, &tag1, &tag2); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - todo_wine ok(tag1 == 0, "Got unexpected tag1 %#I64x.\n", tag1); - todo_wine ok(tag2 == 0, "Got unexpected tag2 %#I64x.\n", tag2); hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL); @@ -17892,7 +17883,6 @@ static void test_device_context_flush(BOOL d3d11) ID2D1DeviceContext_Clear(context, &white); hr = ID2D1DeviceContext_Flush(context, NULL, NULL); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID2D1CommandList_Close(command_list); @@ -17918,12 +17908,10 @@ static void test_device_context_flush(BOOL d3d11) ID2D1DeviceContext_Clear(context, &white); hr = ID2D1DeviceContext_Flush(context, NULL, NULL); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID2D1Bitmap1_Release(bitmap1); hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); /* No target */ @@ -17932,16 +17920,13 @@ static void test_device_context_flush(BOOL d3d11) ID2D1DeviceContext_Clear(context, &white); hr = ID2D1DeviceContext_Flush(context, NULL, NULL); - todo_wine ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr); /* The last Flush() call clears the error code */ hr = ID2D1DeviceContext_Flush(context, NULL, NULL); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); release_test_context(&ctx); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9961