Module: wine Branch: master Commit: 3bd8b710c3b199c8d7e8d9d4b6a3b42231496a3b URL: https://source.winehq.org/git/wine.git/?a=commit;h=3bd8b710c3b199c8d7e8d9d4b...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Jan 23 18:35:22 2019 +0330
ddraw: Implement ddraw7_FlipToGDISurface().
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 6b2abe3..c0c49db 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 d52fc31..20ec329 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 bacc35d..1e16f2b 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 0066bf7..6f99176 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 9374edb..6128373 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);