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

This commit is contained in:
Henri Verbeet 2013-12-04 09:49:34 +01:00 committed by Alexandre Julliard
parent ab8d59c29d
commit 74e3f516bc
5 changed files with 24 additions and 23 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);