Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/ddraw/ddraw.c | 27 +++++++++++++++++++++++++-- dlls/ddraw/tests/ddraw1.c | 4 ++-- dlls/ddraw/tests/ddraw2.c | 4 ++-- dlls/ddraw/tests/ddraw4.c | 4 ++-- dlls/ddraw/tests/ddraw7.c | 4 ++-- 5 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 6b2abe3c1f9..c0c49dbab1e 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2063,9 +2063,32 @@ static HRESULT WINAPI d3d1_Initialize(IDirect3D *iface, REFIID riid) *****************************************************************************/ static HRESULT WINAPI ddraw7_FlipToGDISurface(IDirectDraw7 *iface) { - FIXME("iface %p stub!\n", iface); + struct ddraw *ddraw = impl_from_IDirectDraw7(iface); + IDirectDrawSurface7 *gdi_surface; + struct ddraw_surface *gdi_impl; + HRESULT hr;
- return DD_OK; + TRACE("iface %p.\n", iface); + + wined3d_mutex_lock(); + + if (FAILED(hr = IDirectDraw7_GetGDISurface(iface, &gdi_surface))) + { + WARN("Failed to retrieve GDI surface, hr %#x.\n", hr); + wined3d_mutex_unlock(); + return hr; + } + + gdi_impl = impl_from_IDirectDrawSurface7(gdi_surface); + if (gdi_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER) + hr = DD_OK; + else + hr = IDirectDrawSurface7_Flip(&ddraw->primary->IDirectDrawSurface7_iface, gdi_surface, DDFLIP_WAIT); + IDirectDrawSurface7_Release(gdi_surface); + + wined3d_mutex_unlock(); + + return hr; }
static HRESULT WINAPI ddraw4_FlipToGDISurface(IDirectDraw4 *iface) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index d52fc313c4b..20ec3291c5c 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -12036,7 +12036,7 @@ static void test_gdi_surface(void) ok(!gdi_surface, "Got unexpected surface %p.\n", gdi_surface);
hr = IDirectDraw_FlipToGDISurface(ddraw); - todo_wine ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -12053,7 +12053,7 @@ static void test_gdi_surface(void) /* Flipping to the GDI surface requires the primary surface to be * flippable. */ hr = IDirectDraw_FlipToGDISurface(ddraw); - todo_wine ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(primary);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index bacc35d31d8..1e16f2be9c1 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -13337,7 +13337,7 @@ static void test_gdi_surface(void) ok(!gdi_surface, "Got unexpected surface %p.\n", gdi_surface);
hr = IDirectDraw2_FlipToGDISurface(ddraw); - todo_wine ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -13354,7 +13354,7 @@ static void test_gdi_surface(void) /* Flipping to the GDI surface requires the primary surface to be * flippable. */ hr = IDirectDraw2_FlipToGDISurface(ddraw); - todo_wine ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(primary);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 0066bf770f9..6f9917643d2 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -15542,7 +15542,7 @@ static void test_gdi_surface(void) ok(!gdi_surface, "Got unexpected surface %p.\n", gdi_surface);
hr = IDirectDraw4_FlipToGDISurface(ddraw); - todo_wine ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -15559,7 +15559,7 @@ static void test_gdi_surface(void) /* Flipping to the GDI surface requires the primary surface to be * flippable. */ hr = IDirectDraw4_FlipToGDISurface(ddraw); - todo_wine ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface4_Release(primary);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 1f57420250e..21f8806999a 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -15250,7 +15250,7 @@ static void test_gdi_surface(void) ok(!gdi_surface, "Got unexpected surface %p.\n", gdi_surface);
hr = IDirectDraw7_FlipToGDISurface(ddraw); - todo_wine ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -15267,7 +15267,7 @@ static void test_gdi_surface(void) /* Flipping to the GDI surface requires the primary surface to be * flippable. */ hr = IDirectDraw7_FlipToGDISurface(ddraw); - todo_wine ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr); + ok(hr == DDERR_NOTFLIPPABLE, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface7_Release(primary);