Commit 74e3f516 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Attach the first surface in the swap chain to the last one.

parent ab8d59c2
......@@ -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)
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment