2 * IDirect3DTexture8 implementation
4 * Copyright 2002 Jason Edmeades
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "wine/debug.h"
27 #include "d3d8_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
31 /* IDirect3DTexture8 IUnknown parts follow: */
32 HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface,REFIID riid,LPVOID *ppobj)
34 ICOM_THIS(IDirect3DTexture8Impl,iface);
35 TRACE("(%p) : QueryInterface\n", This);
36 if (IsEqualGUID(riid, &IID_IUnknown)
37 || IsEqualGUID(riid, &IID_IDirect3DResource8)
38 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)
39 || IsEqualGUID(riid, &IID_IDirect3DTexture8)) {
40 IDirect3DTexture8Impl_AddRef(iface);
45 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
49 ULONG WINAPI IDirect3DTexture8Impl_AddRef(LPDIRECT3DTEXTURE8 iface) {
50 ICOM_THIS(IDirect3DTexture8Impl,iface);
51 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
55 ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) {
56 ICOM_THIS(IDirect3DTexture8Impl,iface);
57 ULONG ref = --This->ref;
60 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
62 for (i=0; i<This->levels; i++) {
63 if (This->surfaces[i] != NULL) {
64 TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[i]);
65 IDirect3DSurface8Impl_Release((LPDIRECT3DSURFACE8) This->surfaces[i]);
68 HeapFree(GetProcessHeap(), 0, This);
73 /* IDirect3DTexture8 IDirect3DResource8 Interface follow: */
74 HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(LPDIRECT3DTEXTURE8 iface, IDirect3DDevice8** ppDevice) {
75 ICOM_THIS(IDirect3DTexture8Impl,iface);
76 TRACE("(%p) : returning %p\n", This, This->Device);
77 *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
80 HRESULT WINAPI IDirect3DTexture8Impl_SetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
81 ICOM_THIS(IDirect3DTexture8Impl,iface);
82 FIXME("(%p) : stub\n", This); return D3D_OK;
84 HRESULT WINAPI IDirect3DTexture8Impl_GetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
85 ICOM_THIS(IDirect3DTexture8Impl,iface);
86 FIXME("(%p) : stub\n", This); return D3D_OK;
88 HRESULT WINAPI IDirect3DTexture8Impl_FreePrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid) {
89 ICOM_THIS(IDirect3DTexture8Impl,iface);
90 FIXME("(%p) : stub\n", This); return D3D_OK;
92 DWORD WINAPI IDirect3DTexture8Impl_SetPriority(LPDIRECT3DTEXTURE8 iface, DWORD PriorityNew) {
93 ICOM_THIS(IDirect3DTexture8Impl,iface);
94 FIXME("(%p) : stub\n", This); return D3D_OK;
96 DWORD WINAPI IDirect3DTexture8Impl_GetPriority(LPDIRECT3DTEXTURE8 iface) {
97 ICOM_THIS(IDirect3DTexture8Impl,iface);
98 FIXME("(%p) : stub\n", This); return D3D_OK;
100 void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) {
101 ICOM_THIS(IDirect3DTexture8Impl,iface);
102 FIXME("(%p) : stub\n", This);
104 D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(LPDIRECT3DTEXTURE8 iface) {
105 ICOM_THIS(IDirect3DTexture8Impl,iface);
106 TRACE("(%p) : is %d \n", This, This->ResourceType);
107 return This->ResourceType;
110 /* IDirect3DTexture8 IDirect3DBaseTexture8 Interface follow: */
111 DWORD WINAPI IDirect3DTexture8Impl_SetLOD(LPDIRECT3DTEXTURE8 iface, DWORD LODNew) {
112 ICOM_THIS(IDirect3DTexture8Impl,iface);
113 FIXME("(%p) : stub\n", This); return D3D_OK;
115 DWORD WINAPI IDirect3DTexture8Impl_GetLOD(LPDIRECT3DTEXTURE8 iface) {
116 ICOM_THIS(IDirect3DTexture8Impl,iface);
117 FIXME("(%p) : stub\n", This); return D3D_OK;
119 DWORD WINAPI IDirect3DTexture8Impl_GetLevelCount(LPDIRECT3DTEXTURE8 iface) {
120 ICOM_THIS(IDirect3DTexture8Impl,iface);
121 TRACE("(%p) : returning %d\n", This, This->levels);
125 /* IDirect3DTexture8 */
126 HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 iface, UINT Level,D3DSURFACE_DESC* pDesc) {
127 ICOM_THIS(IDirect3DTexture8Impl,iface);
129 if (Level < This->levels) {
130 TRACE("(%p) Level (%d)\n", This, Level);
131 return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8)This->surfaces[Level], pDesc);
133 FIXME("(%p) Level (%d)\n", This, Level);
137 HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE8 iface, UINT Level,IDirect3DSurface8** ppSurfaceLevel) {
138 ICOM_THIS(IDirect3DTexture8Impl,iface);
139 *ppSurfaceLevel = (LPDIRECT3DSURFACE8)This->surfaces[Level];
140 IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8)This->surfaces[Level]);
141 TRACE("(%p) : returning %p for level %d\n", This, *ppSurfaceLevel, Level);
144 HRESULT WINAPI IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) {
145 ICOM_THIS(IDirect3DTexture8Impl,iface);
146 TRACE("(%p) Level (%d)\n", This, Level);
147 if (Level < This->levels) {
148 return IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8)This->surfaces[Level], pLockedRect, pRect, Flags);
150 FIXME("Levels seems too high?!!\n");
154 HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(LPDIRECT3DTEXTURE8 iface, UINT Level) {
155 ICOM_THIS(IDirect3DTexture8Impl,iface);
157 TRACE("(%p) : stub\n", This);
160 HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 iface, CONST RECT* pDirtyRect) {
161 ICOM_THIS(IDirect3DTexture8Impl,iface);
163 FIXME("(%p) : stub\n", This); return D3D_OK;
167 ICOM_VTABLE(IDirect3DTexture8) Direct3DTexture8_Vtbl =
169 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
170 IDirect3DTexture8Impl_QueryInterface,
171 IDirect3DTexture8Impl_AddRef,
172 IDirect3DTexture8Impl_Release,
173 IDirect3DTexture8Impl_GetDevice,
174 IDirect3DTexture8Impl_SetPrivateData,
175 IDirect3DTexture8Impl_GetPrivateData,
176 IDirect3DTexture8Impl_FreePrivateData,
177 IDirect3DTexture8Impl_SetPriority,
178 IDirect3DTexture8Impl_GetPriority,
179 IDirect3DTexture8Impl_PreLoad,
180 IDirect3DTexture8Impl_GetType,
181 IDirect3DTexture8Impl_SetLOD,
182 IDirect3DTexture8Impl_GetLOD,
183 IDirect3DTexture8Impl_GetLevelCount,
184 IDirect3DTexture8Impl_GetLevelDesc,
185 IDirect3DTexture8Impl_GetSurfaceLevel,
186 IDirect3DTexture8Impl_LockRect,
187 IDirect3DTexture8Impl_UnlockRect,
188 IDirect3DTexture8Impl_AddDirtyRect