Commit d01e0647 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9: Get rid of IDirect3DBaseTexture9Impl.

parent 5145b131
......@@ -289,20 +289,6 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
IDirect3DIndexBuffer9Impl *unsafe_impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface) DECLSPEC_HIDDEN;
/* --------------------- */
/* IDirect3DBaseTexture9 */
/* --------------------- */
/*****************************************************************************
* IDirect3DBaseTexture9 implementation structure
*/
typedef struct IDirect3DBaseTexture9Impl
{
const IDirect3DBaseTexture9Vtbl *lpVtbl;
LONG ref;
struct wined3d_texture *wined3d_texture;
} IDirect3DBaseTexture9Impl;
struct d3d9_texture
{
IDirect3DBaseTexture9 IDirect3DBaseTexture9_iface;
......@@ -317,6 +303,7 @@ HRESULT texture_init(struct d3d9_texture *texture, IDirect3DDevice9Impl *device,
UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
HRESULT volumetexture_init(struct d3d9_texture *texture, IDirect3DDevice9Impl *device,
UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface) DECLSPEC_HIDDEN;
/* ----------------------- */
/* IDirect3DStateBlock9 */
......
......@@ -975,14 +975,17 @@ static HRESULT WINAPI IDirect3DDevice9Impl_UpdateTexture(IDirect3DDevice9Ex *ifa
IDirect3DBaseTexture9 *src_texture, IDirect3DBaseTexture9 *dst_texture)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
struct d3d9_texture *src_impl, *dst_impl;
HRESULT hr;
TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, src_texture, dst_texture);
src_impl = unsafe_impl_from_IDirect3DBaseTexture9(src_texture);
dst_impl = unsafe_impl_from_IDirect3DBaseTexture9(dst_texture);
wined3d_mutex_lock();
hr = wined3d_device_update_texture(This->wined3d_device,
((IDirect3DBaseTexture9Impl *)src_texture)->wined3d_texture,
((IDirect3DBaseTexture9Impl *)dst_texture)->wined3d_texture);
src_impl->wined3d_texture, dst_impl->wined3d_texture);
wined3d_mutex_unlock();
return hr;
......@@ -1717,13 +1720,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(IDirect3DDevice9Ex *iface,
IDirect3DBaseTexture9 *texture)
{
IDirect3DDevice9Impl *device = impl_from_IDirect3DDevice9Ex(iface);
struct d3d9_texture *texture_impl;
HRESULT hr;
TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
texture_impl = unsafe_impl_from_IDirect3DBaseTexture9(texture);
wined3d_mutex_lock();
hr = wined3d_device_set_texture(device->wined3d_device, stage,
texture ? ((IDirect3DBaseTexture9Impl *)texture)->wined3d_texture : NULL);
texture_impl ? texture_impl->wined3d_texture : NULL);
wined3d_mutex_unlock();
return hr;
......
......@@ -1243,6 +1243,16 @@ static const IDirect3DVolumeTexture9Vtbl d3d9_texture_3d_vtbl =
d3d9_texture_3d_AddDirtyBox,
};
struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl
|| iface->lpVtbl == (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl
|| iface->lpVtbl == (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl);
return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
}
static void STDMETHODCALLTYPE d3d9_texture_wined3d_object_destroyed(void *parent)
{
HeapFree(GetProcessHeap(), 0, parent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment