Module: wine Branch: master Commit: f48f5155eee169666ed36d324f90fd9884f63793 URL: https://gitlab.winehq.org/wine/wine/-/commit/f48f5155eee169666ed36d324f90fd9...
Author: Paul Gofman pgofman@codeweavers.com Date: Mon Aug 15 20:16:58 2022 -0500
ddraw: Restore full complex attachment chain in ddraw_surface7_Restore().
---
dlls/ddraw/surface.c | 12 ++++++++++-- dlls/ddraw/tests/ddraw1.c | 2 +- dlls/ddraw/tests/ddraw2.c | 2 +- dlls/ddraw/tests/ddraw4.c | 2 +- dlls/ddraw/tests/ddraw7.c | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index afba0d5ac4b..038539632e1 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -3787,6 +3787,7 @@ static HRESULT WINAPI ddraw_surface1_IsLost(IDirectDrawSurface *iface) static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface) { struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); + struct ddraw_surface *attachment; unsigned int i;
TRACE("iface %p.\n", iface); @@ -3832,10 +3833,17 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface) return DDERR_WRONGMODE;
surface->is_lost = FALSE; + for(i = 0; i < MAX_COMPLEX_ATTACHED; i++) { - if (surface->complex_array[i]) - surface->complex_array[i]->is_lost = FALSE; + attachment = surface->complex_array[i]; + while (attachment) + { + attachment->is_lost = FALSE; + attachment = attachment->complex_array[0]; + if (attachment == surface->complex_array[i]) + break; + } }
return DD_OK; diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 8d5896e45a0..1629660aedc 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -8241,7 +8241,7 @@ static void test_lost_device(void) ok(back_buffer2 != back_buffer, "Got the same surface.\n"); ok(back_buffer2 != surface, "Got the same surface.\n"); hr = IDirectDrawSurface_IsLost(back_buffer2); - todo_wine ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); IDirectDrawSurface_Release(back_buffer2);
if (ds) diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 22cd59ec9b0..0aea1587156 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -9236,7 +9236,7 @@ static void test_lost_device(void) ok(back_buffer2 != back_buffer, "Got the same surface.\n"); ok(back_buffer2 != surface, "Got the same surface.\n"); hr = IDirectDrawSurface_IsLost(back_buffer2); - todo_wine ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); IDirectDrawSurface_Release(back_buffer2);
if (ds) diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index c1bd91dec88..ab37adc000a 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -10655,7 +10655,7 @@ static void test_lost_device(void) ok(back_buffer2 != back_buffer, "Got the same surface.\n"); ok(back_buffer2 != surface, "Got the same surface.\n"); hr = IDirectDrawSurface4_IsLost(back_buffer2); - todo_wine ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); IDirectDrawSurface4_Release(back_buffer2);
if (ds) diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 8ea566cee4c..c72ea64c17d 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -10405,7 +10405,7 @@ static void test_lost_device(void) ok(back_buffer2 != back_buffer, "Got the same surface.\n"); ok(back_buffer2 != surface, "Got the same surface.\n"); hr = IDirectDrawSurface7_IsLost(back_buffer2); - todo_wine ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); IDirectDrawSurface7_Release(back_buffer2);
if (ds)