Add a stub implementation of mprapi.dll.
[wine] / dlls / d3d9 / basetexture.c
1 /*
2  * IDirect3DBaseTexture9 implementation
3  *
4  * Copyright 2002-2004 Jason Edmeades
5  *                     Raphael Junqueira
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23 #include "d3d9_private.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
26
27 /* IDirect3DBaseTexture9 IUnknown parts follow: */
28 HRESULT WINAPI IDirect3DBaseTexture9Impl_QueryInterface(LPDIRECT3DBASETEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
29     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
30     TRACE("(%p) Relay\n" , This);
31     if (IsEqualGUID(riid, &IID_IUnknown)
32         || IsEqualGUID(riid, &IID_IDirect3DResource9)
33         || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)) {
34         IUnknown_AddRef(iface);
35         *ppobj = This;
36         return D3D_OK;
37     }
38
39     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
40     return E_NOINTERFACE;
41 }
42
43 ULONG WINAPI IDirect3DBaseTexture9Impl_AddRef(LPDIRECT3DBASETEXTURE9 iface) {
44     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
45     ULONG ref = InterlockedIncrement(&This->ref);
46
47     TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
48
49     return ref;
50 }
51
52 ULONG WINAPI IDirect3DBaseTexture9Impl_Release(LPDIRECT3DBASETEXTURE9 iface) {
53     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
54     ULONG ref = InterlockedDecrement(&This->ref);
55
56     TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
57
58     if (ref == 0) {
59         IWineD3DBaseTexture_Release(This->wineD3DBaseTexture);
60         HeapFree(GetProcessHeap(), 0, This);
61     }
62     return ref;
63 }
64
65 /* IDirect3DBaseTexture9 IDirect3DResource9 Interface follow: */
66 HRESULT WINAPI IDirect3DBaseTexture9Impl_GetDevice(LPDIRECT3DBASETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
67     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
68     TRACE("(%p) Relay\n" , This);
69     return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
70 }
71
72 HRESULT WINAPI IDirect3DBaseTexture9Impl_SetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
73     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
74     TRACE("(%p) Relay\n" , This);
75     return IWineD3DBaseTexture_SetPrivateData(This->wineD3DBaseTexture, refguid, pData, SizeOfData, Flags);
76 }
77
78 HRESULT WINAPI IDirect3DBaseTexture9Impl_GetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
79     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
80     TRACE("(%p) Relay\n" , This);
81     return IWineD3DBaseTexture_GetPrivateData(This->wineD3DBaseTexture, refguid, pData, pSizeOfData);
82 }
83
84 HRESULT WINAPI IDirect3DBaseTexture9Impl_FreePrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid) {
85     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
86     TRACE("(%p) Relay\n" , This);
87     return IWineD3DBaseTexture_FreePrivateData(This->wineD3DBaseTexture, refguid);
88 }
89
90 DWORD WINAPI IDirect3DBaseTexture9Impl_SetPriority(LPDIRECT3DBASETEXTURE9 iface, DWORD PriorityNew) {
91     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
92     TRACE("(%p) Relay\n" , This);
93     return IWineD3DBaseTexture_SetPriority(This->wineD3DBaseTexture, PriorityNew);
94 }
95
96 DWORD WINAPI IDirect3DBaseTexture9Impl_GetPriority(LPDIRECT3DBASETEXTURE9 iface) {
97     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
98     TRACE("(%p) Relay\n" , This);
99     return IWineD3DBaseTexture_GetPriority(This->wineD3DBaseTexture);
100 }
101
102 void WINAPI IDirect3DBaseTexture9Impl_PreLoad(LPDIRECT3DBASETEXTURE9 iface) {
103     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
104     TRACE("(%p) Relay\n" , This);
105     IWineD3DBaseTexture_PreLoad(This->wineD3DBaseTexture);
106     return ;
107 }
108
109 D3DRESOURCETYPE WINAPI IDirect3DBaseTexture9Impl_GetType(LPDIRECT3DBASETEXTURE9 iface) {
110     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
111     TRACE("(%p) Relay\n" , This);
112     return IWineD3DBaseTexture_GetType(This->wineD3DBaseTexture);
113 }
114
115 /* IDirect3DBaseTexture9 Interface follow: */
116 DWORD  WINAPI IDirect3DBaseTexture9Impl_SetLOD(LPDIRECT3DBASETEXTURE9 iface, DWORD LODNew) {
117     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
118     TRACE("(%p) Relay\n" , This);
119     return IWineD3DBaseTexture_SetLOD(This->wineD3DBaseTexture, LODNew);
120 }
121
122 DWORD WINAPI IDirect3DBaseTexture9Impl_GetLOD(LPDIRECT3DBASETEXTURE9 iface) {
123     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
124     TRACE("(%p) Relay\n" , This);
125     return IWineD3DBaseTexture_GetLOD(This->wineD3DBaseTexture);
126 }
127
128 DWORD WINAPI IDirect3DBaseTexture9Impl_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface) {
129     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
130     TRACE("(%p) Relay\n" , This);
131     return IWineD3DBaseTexture_GetLevelCount(This->wineD3DBaseTexture);
132 }
133
134 HRESULT WINAPI IDirect3DBaseTexture9Impl_SetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
135     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
136     TRACE("(%p) Relay\n" , This);
137     return IWineD3DBaseTexture_SetAutoGenFilterType(This->wineD3DBaseTexture, (WINED3DTEXTUREFILTERTYPE) FilterType);
138 }
139
140 D3DTEXTUREFILTERTYPE WINAPI IDirect3DBaseTexture9Impl_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface) {
141     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
142     TRACE("(%p) Relay\n" , This);
143     return (D3DTEXTUREFILTERTYPE) IWineD3DBaseTexture_GetAutoGenFilterType(This->wineD3DBaseTexture);
144 }
145
146 void WINAPI IDirect3DBaseTexture9Impl_GenerateMipSubLevels(LPDIRECT3DBASETEXTURE9 iface) {
147     IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
148     TRACE("(%p) Relay\n" , This);
149     return IWineD3DBaseTexture_GenerateMipSubLevels(This->wineD3DBaseTexture);
150 }
151
152 const IDirect3DBaseTexture9Vtbl Direct3DBaseTexture9_Vtbl =
153 {
154     IDirect3DBaseTexture9Impl_QueryInterface,
155     IDirect3DBaseTexture9Impl_AddRef,
156     IDirect3DBaseTexture9Impl_Release,
157     IDirect3DBaseTexture9Impl_GetDevice,
158     IDirect3DBaseTexture9Impl_SetPrivateData,
159     IDirect3DBaseTexture9Impl_GetPrivateData,
160     IDirect3DBaseTexture9Impl_FreePrivateData,
161     IDirect3DBaseTexture9Impl_SetPriority,
162     IDirect3DBaseTexture9Impl_GetPriority,
163     IDirect3DBaseTexture9Impl_PreLoad,
164     IDirect3DBaseTexture9Impl_GetType,
165     IDirect3DBaseTexture9Impl_SetLOD,
166     IDirect3DBaseTexture9Impl_GetLOD,
167     IDirect3DBaseTexture9Impl_GetLevelCount,
168     IDirect3DBaseTexture9Impl_SetAutoGenFilterType,
169     IDirect3DBaseTexture9Impl_GetAutoGenFilterType,
170     IDirect3DBaseTexture9Impl_GenerateMipSubLevels   
171 };