basetexture.c 6.64 KB
Newer Older
1 2 3
/*
 * IDirect3DBaseTexture9 implementation
 *
4
 * Copyright 2002-2004 Jason Edmeades
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
 *                     Raphael Junqueira
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "config.h"
#include "d3d9_private.h"

WINE_DEFAULT_DEBUG_CHANNEL(d3d);

/* IDirect3DBaseTexture9 IUnknown parts follow: */
HRESULT WINAPI IDirect3DBaseTexture9Impl_QueryInterface(LPDIRECT3DBASETEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
29
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
30 31 32 33 34 35 36 37 38 39 40 41 42 43

    if (IsEqualGUID(riid, &IID_IUnknown)
        || IsEqualGUID(riid, &IID_IDirect3DResource9)
        || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)) {
        IDirect3DBaseTexture9Impl_AddRef(iface);
        *ppobj = This;
        return D3D_OK;
    }

    WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
    return E_NOINTERFACE;
}

ULONG WINAPI IDirect3DBaseTexture9Impl_AddRef(LPDIRECT3DBASETEXTURE9 iface) {
44
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
45 46 47 48 49
    ULONG ref = InterlockedIncrement(&This->ref);

    TRACE("(%p) : AddRef from %ld\n", This, ref - 1);

    return ref;
50 51 52
}

ULONG WINAPI IDirect3DBaseTexture9Impl_Release(LPDIRECT3DBASETEXTURE9 iface) {
53
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
54
    ULONG ref = InterlockedDecrement(&This->ref);
55 56 57

    TRACE("(%p) : ReleaseRef to %ld\n", This, ref);

58 59
    if (ref == 0) {
        IWineD3DBaseTexture_Release(This->wineD3DBaseTexture);
60
        HeapFree(GetProcessHeap(), 0, This);
61
    }
62 63 64 65 66
    return ref;
}

/* IDirect3DBaseTexture9 IDirect3DResource9 Interface follow: */
HRESULT WINAPI IDirect3DBaseTexture9Impl_GetDevice(LPDIRECT3DBASETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
67
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
68 69 70 71
    return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
}

HRESULT WINAPI IDirect3DBaseTexture9Impl_SetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
72
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
73
    return IWineD3DBaseTexture_SetPrivateData(This->wineD3DBaseTexture, refguid, pData, SizeOfData, Flags);
74 75 76
}

HRESULT WINAPI IDirect3DBaseTexture9Impl_GetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
77
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
78
    return IWineD3DBaseTexture_GetPrivateData(This->wineD3DBaseTexture, refguid, pData, pSizeOfData);
79 80 81
}

HRESULT WINAPI IDirect3DBaseTexture9Impl_FreePrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid) {
82
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
83
    return IWineD3DBaseTexture_FreePrivateData(This->wineD3DBaseTexture, refguid);
84 85 86
}

DWORD WINAPI IDirect3DBaseTexture9Impl_SetPriority(LPDIRECT3DBASETEXTURE9 iface, DWORD PriorityNew) {
87
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
88
    return IWineD3DBaseTexture_SetPriority(This->wineD3DBaseTexture, PriorityNew);
89 90 91
}

DWORD WINAPI IDirect3DBaseTexture9Impl_GetPriority(LPDIRECT3DBASETEXTURE9 iface) {
92
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
93
    return IWineD3DBaseTexture_GetPriority(This->wineD3DBaseTexture);
94 95 96
}

void WINAPI IDirect3DBaseTexture9Impl_PreLoad(LPDIRECT3DBASETEXTURE9 iface) {
97
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
98
    IWineD3DBaseTexture_PreLoad(This->wineD3DBaseTexture);
99 100 101 102
    return ;
}

D3DRESOURCETYPE WINAPI IDirect3DBaseTexture9Impl_GetType(LPDIRECT3DBASETEXTURE9 iface) {
103
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
104
    return IWineD3DBaseTexture_GetType(This->wineD3DBaseTexture);
105 106 107 108
}

/* IDirect3DBaseTexture9 Interface follow: */
DWORD  WINAPI IDirect3DBaseTexture9Impl_SetLOD(LPDIRECT3DBASETEXTURE9 iface, DWORD LODNew) {
109
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
110
    return IWineD3DBaseTexture_SetLOD(This->wineD3DBaseTexture, LODNew);
111 112 113
}

DWORD WINAPI IDirect3DBaseTexture9Impl_GetLOD(LPDIRECT3DBASETEXTURE9 iface) {
114
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
115
    return IWineD3DBaseTexture_GetLOD(This->wineD3DBaseTexture);
116 117 118
}

DWORD WINAPI IDirect3DBaseTexture9Impl_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface) {
119
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
120
    return IWineD3DBaseTexture_GetLevelCount(This->wineD3DBaseTexture);
121 122 123
}

HRESULT WINAPI IDirect3DBaseTexture9Impl_SetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
124 125
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
    return IWineD3DBaseTexture_SetAutoGenFilterType(This->wineD3DBaseTexture, FilterType);
126 127 128
}

D3DTEXTUREFILTERTYPE WINAPI IDirect3DBaseTexture9Impl_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface) {
129 130
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
    return IWineD3DBaseTexture_GetAutoGenFilterType(This->wineD3DBaseTexture);
131 132 133
}

void WINAPI IDirect3DBaseTexture9Impl_GenerateMipSubLevels(LPDIRECT3DBASETEXTURE9 iface) {
134 135
    IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
    return IWineD3DBaseTexture_GenerateMipSubLevels(This->wineD3DBaseTexture);
136 137
}

138
IDirect3DBaseTexture9Vtbl Direct3DBaseTexture9_Vtbl =
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
{
    IDirect3DBaseTexture9Impl_QueryInterface,
    IDirect3DBaseTexture9Impl_AddRef,
    IDirect3DBaseTexture9Impl_Release,
    IDirect3DBaseTexture9Impl_GetDevice,
    IDirect3DBaseTexture9Impl_SetPrivateData,
    IDirect3DBaseTexture9Impl_GetPrivateData,
    IDirect3DBaseTexture9Impl_FreePrivateData,
    IDirect3DBaseTexture9Impl_SetPriority,
    IDirect3DBaseTexture9Impl_GetPriority,
    IDirect3DBaseTexture9Impl_PreLoad,
    IDirect3DBaseTexture9Impl_GetType,
    IDirect3DBaseTexture9Impl_SetLOD,
    IDirect3DBaseTexture9Impl_GetLOD,
    IDirect3DBaseTexture9Impl_GetLevelCount,
    IDirect3DBaseTexture9Impl_SetAutoGenFilterType,
    IDirect3DBaseTexture9Impl_GetAutoGenFilterType,
    IDirect3DBaseTexture9Impl_GenerateMipSubLevels   
};