ddraw: The texture interface shares its refcount with the surface interface version used to create the surface.

This probably implies that on native the texture interface is part of a
separate object that's aggregated by the surface.
This commit is contained in:
Henri Verbeet 2012-04-01 13:12:03 +02:00 committed by Alexandre Julliard
parent 7dd4f439e3
commit 814fd3b39e
2 changed files with 12 additions and 6 deletions

View File

@ -151,6 +151,7 @@ struct ddraw_surface
LONG ref7, ref4, ref3, ref2, ref1, iface_count, gamma_count; LONG ref7, ref4, ref3, ref2, ref1, iface_count, gamma_count;
IUnknown *ifaceToRelease; IUnknown *ifaceToRelease;
IUnknown *texture_outer;
int version; int version;

View File

@ -429,7 +429,7 @@ static ULONG WINAPI d3d_texture2_AddRef(IDirect3DTexture2 *iface)
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface1_AddRef(&surface->IDirectDrawSurface_iface); return IUnknown_AddRef(surface->texture_outer);
} }
static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface) static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface)
@ -438,7 +438,7 @@ static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface)
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface1_AddRef(&surface->IDirectDrawSurface_iface); return IUnknown_AddRef(surface->texture_outer);
} }
/***************************************************************************** /*****************************************************************************
@ -659,18 +659,20 @@ static ULONG WINAPI ddraw_gamma_control_Release(IDirectDrawGammaControl *iface)
static ULONG WINAPI d3d_texture2_Release(IDirect3DTexture2 *iface) static ULONG WINAPI d3d_texture2_Release(IDirect3DTexture2 *iface)
{ {
struct ddraw_surface *This = impl_from_IDirect3DTexture2(iface); struct ddraw_surface *surface = impl_from_IDirect3DTexture2(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface1_Release(&This->IDirectDrawSurface_iface); return IUnknown_Release(surface->texture_outer);
} }
static ULONG WINAPI d3d_texture1_Release(IDirect3DTexture *iface) static ULONG WINAPI d3d_texture1_Release(IDirect3DTexture *iface)
{ {
struct ddraw_surface *This = impl_from_IDirect3DTexture(iface); struct ddraw_surface *surface = impl_from_IDirect3DTexture(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return ddraw_surface1_Release(&This->IDirectDrawSurface_iface); return IUnknown_Release(surface->texture_outer);
} }
/***************************************************************************** /*****************************************************************************
@ -5733,14 +5735,17 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
if (version == 7) if (version == 7)
{ {
surface->ref7 = 1; surface->ref7 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface7_iface;
} }
else if (version == 4) else if (version == 4)
{ {
surface->ref4 = 1; surface->ref4 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface4_iface;
} }
else else
{ {
surface->ref1 = 1; surface->ref1 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface_iface;
} }
copy_to_surfacedesc2(&surface->surface_desc, desc); copy_to_surfacedesc2(&surface->surface_desc, desc);