ddraw: Use unsafe_impl_from_IDirect3DTexture2 for application provided interfaces.

This commit is contained in:
Ričardas Barkauskas 2011-07-29 16:30:32 +03:00 committed by Alexandre Julliard
parent 91a1ed8be9
commit 15f16e8f5e
3 changed files with 12 additions and 4 deletions

View File

@ -254,6 +254,7 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface) DECLSPEC_HIDDEN;
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface) DECLSPEC_HIDDEN;
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirect3DTexture2(IDirect3DTexture2 *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))

View File

@ -544,8 +544,8 @@ IDirect3DDeviceImpl_2_SwapTextureHandles(IDirect3DDevice2 *iface,
IDirect3DTexture2 *Tex2)
{
IDirect3DDeviceImpl *This = device_from_device2(iface);
IDirectDrawSurfaceImpl *surf1 = surface_from_texture2(Tex1);
IDirectDrawSurfaceImpl *surf2 = surface_from_texture2(Tex2);
IDirectDrawSurfaceImpl *surf1 = unsafe_impl_from_IDirect3DTexture2(Tex1);
IDirectDrawSurfaceImpl *surf2 = unsafe_impl_from_IDirect3DTexture2(Tex2);
DWORD h1, h2;
TRACE("iface %p, tex1 %p, tex2 %p.\n", iface, Tex1, Tex2);
@ -4564,7 +4564,7 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
IDirect3DTexture2 *Texture2)
{
IDirect3DDeviceImpl *This = device_from_device3(iface);
IDirectDrawSurfaceImpl *tex = Texture2 ? surface_from_texture2(Texture2) : NULL;
IDirectDrawSurfaceImpl *tex = unsafe_impl_from_IDirect3DTexture2(Texture2);
DWORD texmapblend;
HRESULT hr;

View File

@ -4572,7 +4572,7 @@ static IDirectDrawSurfaceImpl *get_sub_mimaplevel(IDirectDrawSurfaceImpl *surfac
static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTexture2 *src_texture)
{
IDirectDrawSurfaceImpl *dst_surface = surface_from_texture2(iface);
IDirectDrawSurfaceImpl *src_surface = surface_from_texture2(src_texture);
IDirectDrawSurfaceImpl *src_surface = unsafe_impl_from_IDirect3DTexture2(src_texture);
HRESULT hr;
TRACE("iface %p, src_texture %p.\n", iface, src_texture);
@ -5030,6 +5030,13 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface_iface);
}
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface)
{
if (!iface) return NULL;
assert(iface->lpVtbl == &d3d_texture2_vtbl);
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirect3DTexture2_vtbl);
}
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface)
{
if (!iface) return NULL;