ddraw: COM cleanup for IDirect3DTexture interface.
This commit is contained in:
parent
0a3582865e
commit
91a1ed8be9
|
@ -159,7 +159,7 @@ struct IDirectDrawSurfaceImpl
|
||||||
IDirectDrawSurface IDirectDrawSurface_iface;
|
IDirectDrawSurface IDirectDrawSurface_iface;
|
||||||
IDirectDrawGammaControl IDirectDrawGammaControl_iface;
|
IDirectDrawGammaControl IDirectDrawGammaControl_iface;
|
||||||
const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl;
|
const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl;
|
||||||
const IDirect3DTextureVtbl *IDirect3DTexture_vtbl;
|
IDirect3DTexture IDirect3DTexture_iface;
|
||||||
|
|
||||||
LONG ref7, ref4, ref3, ref2, ref1, iface_count, gamma_count;
|
LONG ref7, ref4, ref3, ref2, ref1, iface_count, gamma_count;
|
||||||
IUnknown *ifaceToRelease;
|
IUnknown *ifaceToRelease;
|
||||||
|
@ -214,9 +214,9 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
|
||||||
DDSURFACEDESC2 *desc, UINT mip_level, WINED3DSURFTYPE surface_type, UINT version) DECLSPEC_HIDDEN;
|
DDSURFACEDESC2 *desc, UINT mip_level, WINED3DSURFTYPE surface_type, UINT version) DECLSPEC_HIDDEN;
|
||||||
ULONG ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This) DECLSPEC_HIDDEN;
|
ULONG ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
static inline IDirectDrawSurfaceImpl *surface_from_texture1(IDirect3DTexture *iface)
|
static inline IDirectDrawSurfaceImpl *impl_from_IDirect3DTexture(IDirect3DTexture *iface)
|
||||||
{
|
{
|
||||||
return (IDirectDrawSurfaceImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawSurfaceImpl, IDirect3DTexture_vtbl));
|
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirect3DTexture_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline IDirectDrawSurfaceImpl *surface_from_texture2(IDirect3DTexture2 *iface)
|
static inline IDirectDrawSurfaceImpl *surface_from_texture2(IDirect3DTexture2 *iface)
|
||||||
|
|
|
@ -141,7 +141,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
|
||||||
{
|
{
|
||||||
if (IsEqualGUID( &IID_IDirect3DTexture, riid ))
|
if (IsEqualGUID( &IID_IDirect3DTexture, riid ))
|
||||||
{
|
{
|
||||||
*obj = &This->IDirect3DTexture_vtbl;
|
*obj = &This->IDirect3DTexture_iface;
|
||||||
TRACE(" returning Direct3DTexture interface at %p.\n", *obj);
|
TRACE(" returning Direct3DTexture interface at %p.\n", *obj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -209,7 +209,7 @@ static HRESULT WINAPI d3d_texture2_QueryInterface(IDirect3DTexture2 *iface, REFI
|
||||||
|
|
||||||
static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFIID riid, void **object)
|
static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFIID riid, void **object)
|
||||||
{
|
{
|
||||||
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
|
IDirectDrawSurfaceImpl *This = impl_from_IDirect3DTexture(iface);
|
||||||
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
|
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
|
||||||
|
|
||||||
return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object);
|
return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object);
|
||||||
|
@ -340,7 +340,7 @@ static ULONG WINAPI d3d_texture2_AddRef(IDirect3DTexture2 *iface)
|
||||||
|
|
||||||
static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface)
|
static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface)
|
||||||
{
|
{
|
||||||
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
|
IDirectDrawSurfaceImpl *This = impl_from_IDirect3DTexture(iface);
|
||||||
TRACE("iface %p.\n", iface);
|
TRACE("iface %p.\n", iface);
|
||||||
|
|
||||||
return ddraw_surface1_AddRef(&This->IDirectDrawSurface_iface);
|
return ddraw_surface1_AddRef(&This->IDirectDrawSurface_iface);
|
||||||
|
@ -623,7 +623,7 @@ static ULONG WINAPI d3d_texture2_Release(IDirect3DTexture2 *iface)
|
||||||
|
|
||||||
static ULONG WINAPI d3d_texture1_Release(IDirect3DTexture *iface)
|
static ULONG WINAPI d3d_texture1_Release(IDirect3DTexture *iface)
|
||||||
{
|
{
|
||||||
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
|
IDirectDrawSurfaceImpl *This = impl_from_IDirect3DTexture(iface);
|
||||||
TRACE("iface %p.\n", iface);
|
TRACE("iface %p.\n", iface);
|
||||||
|
|
||||||
return ddraw_surface1_Release(&This->IDirectDrawSurface_iface);
|
return ddraw_surface1_Release(&This->IDirectDrawSurface_iface);
|
||||||
|
@ -4450,7 +4450,7 @@ static HRESULT WINAPI d3d_texture2_PaletteChanged(IDirect3DTexture2 *iface, DWOR
|
||||||
|
|
||||||
static HRESULT WINAPI d3d_texture1_PaletteChanged(IDirect3DTexture *iface, DWORD start, DWORD count)
|
static HRESULT WINAPI d3d_texture1_PaletteChanged(IDirect3DTexture *iface, DWORD start, DWORD count)
|
||||||
{
|
{
|
||||||
IDirectDrawSurfaceImpl *surface = surface_from_texture1(iface);
|
IDirectDrawSurfaceImpl *surface = impl_from_IDirect3DTexture(iface);
|
||||||
|
|
||||||
TRACE("iface %p, start %u, count %u.\n", iface, start, count);
|
TRACE("iface %p, start %u, count %u.\n", iface, start, count);
|
||||||
|
|
||||||
|
@ -4521,12 +4521,12 @@ static HRESULT WINAPI d3d_texture2_GetHandle(IDirect3DTexture2 *iface,
|
||||||
static HRESULT WINAPI d3d_texture1_GetHandle(IDirect3DTexture *iface,
|
static HRESULT WINAPI d3d_texture1_GetHandle(IDirect3DTexture *iface,
|
||||||
IDirect3DDevice *device, D3DTEXTUREHANDLE *handle)
|
IDirect3DDevice *device, D3DTEXTUREHANDLE *handle)
|
||||||
{
|
{
|
||||||
IDirect3DTexture2 *texture2 = (IDirect3DTexture2 *)&surface_from_texture1(iface)->IDirect3DTexture2_vtbl;
|
IDirectDrawSurfaceImpl *This = impl_from_IDirect3DTexture(iface);
|
||||||
IDirect3DDevice2 *device2 = (IDirect3DDevice2 *)&device_from_device1(device)->IDirect3DDevice2_vtbl;
|
IDirect3DDevice2 *device2 = (IDirect3DDevice2 *)&device_from_device1(device)->IDirect3DDevice2_vtbl;
|
||||||
|
|
||||||
TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
|
TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
|
||||||
|
|
||||||
return d3d_texture2_GetHandle(texture2, device2, handle);
|
return d3d_texture2_GetHandle((IDirect3DTexture2 *)&This->IDirect3DTexture2_vtbl, device2, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -4703,10 +4703,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||||
|
|
||||||
static HRESULT WINAPI d3d_texture1_Load(IDirect3DTexture *iface, IDirect3DTexture *src_texture)
|
static HRESULT WINAPI d3d_texture1_Load(IDirect3DTexture *iface, IDirect3DTexture *src_texture)
|
||||||
{
|
{
|
||||||
|
IDirectDrawSurfaceImpl* This = impl_from_IDirect3DTexture(iface);
|
||||||
IDirectDrawSurfaceImpl* src_surface = unsafe_impl_from_IDirect3DTexture(src_texture);
|
IDirectDrawSurfaceImpl* src_surface = unsafe_impl_from_IDirect3DTexture(src_texture);
|
||||||
TRACE("iface %p, src_texture %p.\n", iface, src_texture);
|
TRACE("iface %p, src_texture %p.\n", iface, src_texture);
|
||||||
|
|
||||||
return d3d_texture2_Load((IDirect3DTexture2 *)&surface_from_texture1(iface)->IDirect3DTexture2_vtbl,
|
return d3d_texture2_Load((IDirect3DTexture2 *)&This->IDirect3DTexture2_vtbl,
|
||||||
src_surface ? (IDirect3DTexture2 *)&src_surface->IDirect3DTexture2_vtbl : NULL);
|
src_surface ? (IDirect3DTexture2 *)&src_surface->IDirect3DTexture2_vtbl : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5033,7 +5034,7 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *ifac
|
||||||
{
|
{
|
||||||
if (!iface) return NULL;
|
if (!iface) return NULL;
|
||||||
assert(iface->lpVtbl == &d3d_texture1_vtbl);
|
assert(iface->lpVtbl == &d3d_texture1_vtbl);
|
||||||
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirect3DTexture_vtbl);
|
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirect3DTexture_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *parent)
|
static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *parent)
|
||||||
|
@ -5200,7 +5201,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
|
||||||
surface->IDirectDrawSurface_iface.lpVtbl = &ddraw_surface1_vtbl;
|
surface->IDirectDrawSurface_iface.lpVtbl = &ddraw_surface1_vtbl;
|
||||||
surface->IDirectDrawGammaControl_iface.lpVtbl = &ddraw_gamma_control_vtbl;
|
surface->IDirectDrawGammaControl_iface.lpVtbl = &ddraw_gamma_control_vtbl;
|
||||||
surface->IDirect3DTexture2_vtbl = &d3d_texture2_vtbl;
|
surface->IDirect3DTexture2_vtbl = &d3d_texture2_vtbl;
|
||||||
surface->IDirect3DTexture_vtbl = &d3d_texture1_vtbl;
|
surface->IDirect3DTexture_iface.lpVtbl = &d3d_texture1_vtbl;
|
||||||
surface->iface_count = 1;
|
surface->iface_count = 1;
|
||||||
surface->version = version;
|
surface->version = version;
|
||||||
surface->ddraw = ddraw;
|
surface->ddraw = ddraw;
|
||||||
|
|
Loading…
Reference in New Issue