Added stdole32.tlb.
[wine] / dlls / d3d8 / basetexture.c
1 /*
2  * IDirect3DBaseTexture8 implementation
3  *
4  * Copyright 2002 Jason Edmeades
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include "config.h"
22
23 #include <stdarg.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "wingdi.h"
29 #include "wine/debug.h"
30
31 #include "d3d8_private.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
34
35 /* IDirect3DBaseTexture8 (Inherited from IUnknown) */
36 HRESULT WINAPI IDirect3DBaseTexture8Impl_QueryInterface(LPDIRECT3DBASETEXTURE8 iface,REFIID riid,LPVOID *ppobj)
37 {
38     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
39     TRACE("(%p) : QueryInterface\n", This);
40     if (IsEqualGUID(riid, &IID_IUnknown)
41         || IsEqualGUID(riid, &IID_IDirect3DResource8)
42         || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)) {
43         IDirect3DBaseTexture8Impl_AddRef(iface);
44         *ppobj = This;
45         return D3D_OK;
46     }
47
48     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
49     return E_NOINTERFACE;
50 }
51
52 ULONG WINAPI IDirect3DBaseTexture8Impl_AddRef(LPDIRECT3DBASETEXTURE8 iface) {
53     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
54     ULONG ref = InterlockedIncrement(&This->ref);
55
56     TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
57
58     return ref;
59 }
60
61 ULONG WINAPI IDirect3DBaseTexture8Impl_Release(LPDIRECT3DBASETEXTURE8 iface) {
62     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
63     ULONG ref = InterlockedDecrement(&This->ref);
64
65     TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
66
67     if (ref == 0)
68         HeapFree(GetProcessHeap(), 0, This);
69     return ref;
70 }
71
72 /* IDirect3DBaseTexture8 (Inherited from IDirect3DResource8) */
73 HRESULT  WINAPI        IDirect3DBaseTexture8Impl_GetDevice(LPDIRECT3DBASETEXTURE8 iface, IDirect3DDevice8** ppDevice) {
74     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
75     TRACE("(%p) : returning %p\n", This, This->Device);
76     *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
77     /**
78      * Note  Calling this method will increase the internal reference count 
79      * on the IDirect3DDevice8 interface. 
80      */
81     IDirect3DDevice8Impl_AddRef(*ppDevice);
82     return D3D_OK;
83 }
84 HRESULT  WINAPI        IDirect3DBaseTexture8Impl_SetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
85     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
86     FIXME("(%p) : stub\n", This);    return D3D_OK;
87 }
88 HRESULT  WINAPI        IDirect3DBaseTexture8Impl_GetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
89     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
90     FIXME("(%p) : stub\n", This);    return D3D_OK;
91 }
92 HRESULT  WINAPI        IDirect3DBaseTexture8Impl_FreePrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid) {
93     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
94     FIXME("(%p) : stub\n", This);    return D3D_OK;
95 }
96 DWORD    WINAPI        IDirect3DBaseTexture8Impl_SetPriority(LPDIRECT3DBASETEXTURE8 iface, DWORD PriorityNew) {
97     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
98     FIXME("(%p) : stub\n", This);
99     return 0;
100 }
101 DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetPriority(LPDIRECT3DBASETEXTURE8 iface) {
102     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
103     FIXME("(%p) : stub\n", This);
104     return 0;
105 }
106 void     WINAPI        IDirect3DBaseTexture8Impl_PreLoad(LPDIRECT3DBASETEXTURE8 iface) {
107     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
108     FIXME("(%p) : stub\n", This);
109 }
110 D3DRESOURCETYPE WINAPI IDirect3DBaseTexture8Impl_GetType(LPDIRECT3DBASETEXTURE8 iface) {
111     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
112     /*TRACE("(%p) : returning %d\n", This, This->ResourceType);*/
113     return This->ResourceType;
114 }
115
116 /* IDirect3DBaseTexture8 */
117 DWORD    WINAPI        IDirect3DBaseTexture8Impl_SetLOD(LPDIRECT3DBASETEXTURE8 iface, DWORD LODNew) {
118     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
119     FIXME("(%p) : stub\n", This);
120     return 0;
121 }
122 DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetLOD(LPDIRECT3DBASETEXTURE8 iface) {
123     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
124     FIXME("(%p) : stub\n", This);
125     return 0;
126 }
127 DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetLevelCount(LPDIRECT3DBASETEXTURE8 iface) {
128     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
129     TRACE("(%p) : returning %d\n", This, This->levels);    
130     return This->levels;
131 }
132
133 IDirect3DBaseTexture8Vtbl Direct3DBaseTexture8_Vtbl =
134 {
135     IDirect3DBaseTexture8Impl_QueryInterface,
136     IDirect3DBaseTexture8Impl_AddRef,
137     IDirect3DBaseTexture8Impl_Release,
138     IDirect3DBaseTexture8Impl_GetDevice,
139     IDirect3DBaseTexture8Impl_SetPrivateData,
140     IDirect3DBaseTexture8Impl_GetPrivateData,
141     IDirect3DBaseTexture8Impl_FreePrivateData,
142     IDirect3DBaseTexture8Impl_SetPriority,
143     IDirect3DBaseTexture8Impl_GetPriority,
144     IDirect3DBaseTexture8Impl_PreLoad,
145     IDirect3DBaseTexture8Impl_GetType,
146     IDirect3DBaseTexture8Impl_SetLOD,
147     IDirect3DBaseTexture8Impl_GetLOD,
148     IDirect3DBaseTexture8Impl_GetLevelCount,
149 };
150
151 BOOL WINAPI IDirect3DBaseTexture8Impl_IsDirty(LPDIRECT3DBASETEXTURE8 iface) {
152     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
153     return This->Dirty;
154 }
155
156 BOOL WINAPI IDirect3DBaseTexture8Impl_SetDirty(LPDIRECT3DBASETEXTURE8 iface, BOOL dirty) {
157     BOOL old;
158     IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
159     
160     old = This->Dirty;
161     This->Dirty = dirty;
162     return old;
163 }