ddraw: AddAttachedSurface() just references whatever we pass it.

This commit is contained in:
Henri Verbeet 2012-01-30 21:19:48 +01:00 committed by Alexandre Julliard
parent a534925a48
commit 0d8e6719d5
5 changed files with 20 additions and 12 deletions

View File

@ -1605,8 +1605,8 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa
{
return hr;
}
ddraw_surface7_AddRef(&attachment_impl->IDirectDrawSurface7_iface);
attachment_impl->attached_iface = (IUnknown *)attachment;
IUnknown_AddRef(attachment_impl->attached_iface);
return hr;
}
@ -1624,9 +1624,9 @@ static HRESULT WINAPI ddraw_surface4_AddAttachedSurface(IDirectDrawSurface4 *ifa
{
return hr;
}
ddraw_surface4_AddRef(&attachment_impl->IDirectDrawSurface4_iface);
ddraw_surface7_Release(&attachment_impl->IDirectDrawSurface7_iface);
attachment_impl->attached_iface = (IUnknown *)attachment;
IUnknown_AddRef(attachment_impl->attached_iface);
ddraw_surface7_Release(&attachment_impl->IDirectDrawSurface7_iface);
return hr;
}
static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *iface, IDirectDrawSurface3 *attachment)
@ -1670,8 +1670,8 @@ static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *ifa
{
return hr;
}
ddraw_surface3_AddRef(&attachment_impl->IDirectDrawSurface3_iface);
attachment_impl->attached_iface = (IUnknown *)attachment;
IUnknown_AddRef(attachment_impl->attached_iface);
return hr;
}
@ -1689,9 +1689,9 @@ static HRESULT WINAPI ddraw_surface2_AddAttachedSurface(IDirectDrawSurface2 *ifa
{
return hr;
}
ddraw_surface2_AddRef(&attachment_impl->IDirectDrawSurface2_iface);
ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface);
attachment_impl->attached_iface = (IUnknown *)attachment;
IUnknown_AddRef(attachment_impl->attached_iface);
ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface);
return hr;
}
@ -1709,9 +1709,9 @@ static HRESULT WINAPI ddraw_surface1_AddAttachedSurface(IDirectDrawSurface *ifac
{
return hr;
}
ddraw_surface1_AddRef(&attachment_impl->IDirectDrawSurface_iface);
ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface);
attachment_impl->attached_iface = (IUnknown *)attachment;
IUnknown_AddRef(attachment_impl->attached_iface);
ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface);
return hr;
}

View File

@ -662,6 +662,7 @@ static void test_surface_interface_mismatch(void)
IDirect3DMaterial *background = NULL;
DDSURFACEDESC surface_desc;
DWORD z_depth = 0;
ULONG refcount;
HRESULT hr;
D3DCOLOR color;
HWND window;
@ -728,7 +729,8 @@ static void test_surface_interface_mismatch(void)
/* Using a different surface interface version still works */
hr = IDirectDrawSurface3_AddAttachedSurface(surface3, (IDirectDrawSurface3 *)ds);
ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr);
IDirectDrawSurface_Release(ds);
refcount = IDirectDrawSurface_Release(ds);
ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
if (FAILED(hr))
goto cleanup;

View File

@ -687,6 +687,7 @@ static void test_surface_interface_mismatch(void)
IDirect3DMaterial2 *background = NULL;
DDSURFACEDESC surface_desc;
DWORD z_depth = 0;
ULONG refcount;
HRESULT hr;
D3DCOLOR color;
HWND window;
@ -753,7 +754,8 @@ static void test_surface_interface_mismatch(void)
/* Using a different surface interface version still works */
hr = IDirectDrawSurface3_AddAttachedSurface(surface3, (IDirectDrawSurface3 *)ds);
ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr);
IDirectDrawSurface_Release(ds);
refcount = IDirectDrawSurface_Release(ds);
ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
if (FAILED(hr))
goto cleanup;

View File

@ -875,6 +875,7 @@ static void test_surface_interface_mismatch(void)
IDirect3DViewport3 *viewport = NULL;
DDSURFACEDESC2 surface_desc;
DDPIXELFORMAT z_fmt;
ULONG refcount;
HRESULT hr;
D3DCOLOR color;
HWND window;
@ -936,7 +937,8 @@ static void test_surface_interface_mismatch(void)
/* Using a different surface interface version still works */
hr = IDirectDrawSurface3_AddAttachedSurface(surface3, (IDirectDrawSurface3 *)ds);
ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr);
IDirectDrawSurface4_Release(ds);
refcount = IDirectDrawSurface4_Release(ds);
ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
if (FAILED(hr))
goto cleanup;

View File

@ -841,6 +841,7 @@ static void test_surface_interface_mismatch(void)
IDirect3DDevice7 *device = NULL;
DDSURFACEDESC2 surface_desc;
DDPIXELFORMAT z_fmt;
ULONG refcount;
HRESULT hr;
D3DCOLOR color;
HWND window;
@ -900,7 +901,8 @@ static void test_surface_interface_mismatch(void)
/* Using a different surface interface version still works */
hr = IDirectDrawSurface3_AddAttachedSurface(surface3, (IDirectDrawSurface3 *)ds);
ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr);
IDirectDrawSurface7_Release(ds);
refcount = IDirectDrawSurface7_Release(ds);
ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
if (FAILED(hr))
goto cleanup;