From 881219354fe6d93996e2583c102ea9b638accba2 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 30 Jun 2014 11:17:04 +0200 Subject: [PATCH] ddraw: Implement ddraw7_RestoreAllSurfaces(). --- dlls/ddraw/ddraw.c | 29 +++++++++++------------------ dlls/ddraw/tests/ddraw4.c | 2 +- dlls/ddraw/tests/ddraw7.c | 2 +- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 253a8282a9c..011c1159da9 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2675,27 +2675,20 @@ static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc, return hr; } -/***************************************************************************** - * IDirectDraw7::RestoreAllSurfaces - * - * Calls the restore method of all surfaces - * - * Params: - * - * Returns: - * Always returns DD_OK because it's a stub - * - *****************************************************************************/ +static HRESULT CALLBACK restore_callback(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) +{ + IDirectDrawSurface_Restore(surface); + IDirectDrawSurface_Release(surface); + + return DDENUMRET_OK; +} + static HRESULT WINAPI ddraw7_RestoreAllSurfaces(IDirectDraw7 *iface) { - FIXME("iface %p stub!\n", iface); + TRACE("iface %p.\n", iface); - /* This isn't hard to implement: Enumerate all WineD3D surfaces, - * get their parent and call their restore method. Do not implement - * it in WineD3D, as restoring a surface means re-creating the - * WineD3DDSurface - */ - return DD_OK; + return IDirectDraw7_EnumSurfaces(iface, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, + NULL, NULL, restore_callback); } static HRESULT WINAPI ddraw4_RestoreAllSurfaces(IDirectDraw4 *iface) diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index c5cd58273b9..8bd93175667 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -7718,7 +7718,7 @@ static void test_lost_device(void) hr = IDirectDraw4_TestCooperativeLevel(ddraw); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface4_IsLost(surface); - todo_wine ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); IDirectDrawSurface4_Release(surface); refcount = IDirectDraw4_Release(ddraw); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 7d7bca28212..92e6e999e74 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -7440,7 +7440,7 @@ static void test_lost_device(void) hr = IDirectDraw7_TestCooperativeLevel(ddraw); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface7_IsLost(surface); - todo_wine ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); IDirectDrawSurface7_Release(surface); refcount = IDirectDraw7_Release(ddraw);