ddraw: Use unsafe_impl_from_IDirect3DTexture() for application provided interfaces.
This commit is contained in:
parent
06722210a8
commit
0a3582865e
|
@ -253,6 +253,8 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *
|
|||
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface) DECLSPEC_HIDDEN;
|
||||
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Get the number of bytes per pixel for a given surface */
|
||||
#define PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:((pf.dwRGBBitCount+7)/8))
|
||||
#define GET_BPP(desc) PFGET_BPP(desc.ddpfPixelFormat)
|
||||
|
|
|
@ -568,8 +568,8 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_SwapTextureHandles(IDirect3DDevice *
|
|||
IDirect3DTexture *D3DTex1, IDirect3DTexture *D3DTex2)
|
||||
{
|
||||
IDirect3DDeviceImpl *This = device_from_device1(iface);
|
||||
IDirectDrawSurfaceImpl *surf1 = surface_from_texture1(D3DTex1);
|
||||
IDirectDrawSurfaceImpl *surf2 = surface_from_texture1(D3DTex2);
|
||||
IDirectDrawSurfaceImpl *surf1 = unsafe_impl_from_IDirect3DTexture(D3DTex1);
|
||||
IDirectDrawSurfaceImpl *surf2 = unsafe_impl_from_IDirect3DTexture(D3DTex2);
|
||||
IDirect3DTexture2 *t1 = surf1 ? (IDirect3DTexture2 *)&surf1->IDirect3DTexture2_vtbl : NULL;
|
||||
IDirect3DTexture2 *t2 = surf2 ? (IDirect3DTexture2 *)&surf2->IDirect3DTexture2_vtbl : NULL;
|
||||
|
||||
|
|
|
@ -4703,10 +4703,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
|||
|
||||
static HRESULT WINAPI d3d_texture1_Load(IDirect3DTexture *iface, IDirect3DTexture *src_texture)
|
||||
{
|
||||
IDirectDrawSurfaceImpl* src_surface = unsafe_impl_from_IDirect3DTexture(src_texture);
|
||||
TRACE("iface %p, src_texture %p.\n", iface, src_texture);
|
||||
|
||||
return d3d_texture2_Load((IDirect3DTexture2 *)&surface_from_texture1(iface)->IDirect3DTexture2_vtbl,
|
||||
src_texture ? (IDirect3DTexture2 *)&surface_from_texture1(src_texture)->IDirect3DTexture2_vtbl : NULL);
|
||||
src_surface ? (IDirect3DTexture2 *)&src_surface->IDirect3DTexture2_vtbl : NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -5028,6 +5029,13 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *
|
|||
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface_iface);
|
||||
}
|
||||
|
||||
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface)
|
||||
{
|
||||
if (!iface) return NULL;
|
||||
assert(iface->lpVtbl == &d3d_texture1_vtbl);
|
||||
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirect3DTexture_vtbl);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *parent)
|
||||
{
|
||||
IDirectDrawSurfaceImpl *surface = parent;
|
||||
|
|
Loading…
Reference in New Issue