[PATCH 2/5] ddraw: Attach the first surface in the swap chain to the last one.
Henri Verbeet
hverbeet at codeweavers.com
Wed Dec 4 02:49:34 CST 2013
---
dlls/ddraw/surface.c | 19 ++++++++++++-------
dlls/ddraw/tests/ddraw1.c | 7 +++----
dlls/ddraw/tests/ddraw2.c | 7 +++----
dlls/ddraw/tests/ddraw4.c | 7 +++----
dlls/ddraw/tests/ddraw7.c | 7 +++----
5 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 8d35d1e..477ef4f 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -469,7 +469,8 @@ static void ddraw_surface_cleanup(struct ddraw_surface *surface)
surf = surface->complex_array[i];
surface->complex_array[i] = NULL;
- ddraw_surface_cleanup(surf);
+ if (!surf->is_complex_root)
+ ddraw_surface_cleanup(surf);
}
if (surface->device1)
@@ -4724,19 +4725,22 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir
DDSCAPS2 caps2 = { DDSCAPS_FLIP, 0, 0, 0 };
surf = This;
- while(1)
+ for (;;)
{
IDirectDrawSurface7 *attach;
- HRESULT hr;
- hr = ddraw_surface7_GetAttachedSurface(&surf->IDirectDrawSurface7_iface, &caps2, &attach);
- if(hr != DD_OK)
+
+ if (FAILED(hr = ddraw_surface7_GetAttachedSurface(&surf->IDirectDrawSurface7_iface, &caps2, &attach)))
+ break;
+
+ surf = impl_from_IDirectDrawSurface7(attach);
+ if (surf == This)
{
+ ddraw_surface7_Release(attach);
break;
}
- TRACE("Setting palette on %p\n", attach);
+ TRACE("Setting palette on %p.\n", attach);
ddraw_surface7_SetPalette(attach, Pal);
- surf = impl_from_IDirectDrawSurface7(attach);
ddraw_surface7_Release(attach);
}
}
@@ -6002,6 +6006,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
*attach = last;
attach = &last->complex_array[0];
}
+ *attach = root;
}
if (surface_desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 64f8f37..c8d60fe 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -3605,10 +3605,9 @@ static void test_flip(void)
"Got unexpected caps %#x.\n", surface_desc.ddsCaps.dwCaps);
hr = IDirectDrawSurface_GetAttachedSurface(backbuffer3, &caps, &surface);
- todo_wine ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
- todo_wine ok(surface == primary, "Got unexpected surface %p, expected %p.\n", surface, primary);
- if (surface)
- IDirectDrawSurface_Release(surface);
+ ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
+ ok(surface == primary, "Got unexpected surface %p, expected %p.\n", surface, primary);
+ IDirectDrawSurface_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 77a1419..34559cc 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -4286,10 +4286,9 @@ static void test_flip(void)
"Got unexpected caps %#x.\n", surface_desc.ddsCaps.dwCaps);
hr = IDirectDrawSurface_GetAttachedSurface(backbuffer3, &caps, &surface);
- todo_wine ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
- todo_wine ok(surface == primary, "Got unexpected surface %p, expected %p.\n", surface, primary);
- if (surface)
- IDirectDrawSurface_Release(surface);
+ ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
+ ok(surface == primary, "Got unexpected surface %p, expected %p.\n", surface, primary);
+ IDirectDrawSurface_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 994bfb3..865dc0f 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -4890,10 +4890,9 @@ static void test_flip(void)
"Got unexpected caps %#x.\n", surface_desc.ddsCaps.dwCaps);
hr = IDirectDrawSurface4_GetAttachedSurface(backbuffer3, &caps, &surface);
- todo_wine ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
- todo_wine ok(surface == primary, "Got unexpected surface %p, expected %p.\n", surface, primary);
- if (surface)
- IDirectDrawSurface4_Release(surface);
+ ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
+ ok(surface == primary, "Got unexpected surface %p, expected %p.\n", surface, primary);
+ IDirectDrawSurface4_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 2ea98cb..050d303 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -4777,10 +4777,9 @@ static void test_flip(void)
"Got unexpected caps %#x.\n", surface_desc.ddsCaps.dwCaps);
hr = IDirectDrawSurface7_GetAttachedSurface(backbuffer3, &caps, &surface);
- todo_wine ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
- todo_wine ok(surface == primary, "Got unexpected surface %p, expected %p.\n", surface, primary);
- if (surface)
- IDirectDrawSurface7_Release(surface);
+ ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
+ ok(surface == primary, "Got unexpected surface %p, expected %p.\n", surface, primary);
+ IDirectDrawSurface7_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
--
1.7.10.4
More information about the wine-patches
mailing list