Implemented NtQueryObject and NtSetInformationObject for the
[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 "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "wingdi.h"
27 #include "wine/debug.h"
28
29 #include "d3d8_private.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
32
33 /* IDirect3DBaseTexture8 (Inherited from IUnknown) */
34 HRESULT WINAPI IDirect3DBaseTexture8Impl_QueryInterface(LPDIRECT3DBASETEXTURE8 iface,REFIID riid,LPVOID *ppobj)
35 {
36     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
37     TRACE("(%p) : QueryInterface\n", This);
38     if (IsEqualGUID(riid, &IID_IUnknown)
39         || IsEqualGUID(riid, &IID_IDirect3DResource8)
40         || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)) {
41         IDirect3DBaseTexture8Impl_AddRef(iface);
42         *ppobj = This;
43         return D3D_OK;
44     }
45
46     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
47     return E_NOINTERFACE;
48 }
49
50 ULONG WINAPI IDirect3DBaseTexture8Impl_AddRef(LPDIRECT3DBASETEXTURE8 iface) {
51     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
52     TRACE("(%p) : AddRef from %ld\n", This, This->ref);
53     return ++(This->ref);
54 }
55
56 ULONG WINAPI IDirect3DBaseTexture8Impl_Release(LPDIRECT3DBASETEXTURE8 iface) {
57     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
58     ULONG ref = --This->ref;
59     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
60     if (ref == 0)
61         HeapFree(GetProcessHeap(), 0, This);
62     return ref;
63 }
64
65 /* IDirect3DBaseTexture8 (Inherited from IDirect3DResource8) */
66 HRESULT  WINAPI        IDirect3DBaseTexture8Impl_GetDevice(LPDIRECT3DBASETEXTURE8 iface, IDirect3DDevice8** ppDevice) {
67     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
68     TRACE("(%p) : returning %p\n", This, This->Device);
69     *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
70     /**
71      * Note  Calling this method will increase the internal reference count 
72      * on the IDirect3DDevice8 interface. 
73      */
74     IDirect3DDevice8Impl_AddRef(*ppDevice);
75     return D3D_OK;
76 }
77 HRESULT  WINAPI        IDirect3DBaseTexture8Impl_SetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
78     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
79     FIXME("(%p) : stub\n", This);    return D3D_OK;
80 }
81 HRESULT  WINAPI        IDirect3DBaseTexture8Impl_GetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
82     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
83     FIXME("(%p) : stub\n", This);    return D3D_OK;
84 }
85 HRESULT  WINAPI        IDirect3DBaseTexture8Impl_FreePrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid) {
86     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
87     FIXME("(%p) : stub\n", This);    return D3D_OK;
88 }
89 DWORD    WINAPI        IDirect3DBaseTexture8Impl_SetPriority(LPDIRECT3DBASETEXTURE8 iface, DWORD PriorityNew) {
90     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
91     FIXME("(%p) : stub\n", This);
92     return 0;
93 }
94 DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetPriority(LPDIRECT3DBASETEXTURE8 iface) {
95     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
96     FIXME("(%p) : stub\n", This);
97     return 0;
98 }
99 void     WINAPI        IDirect3DBaseTexture8Impl_PreLoad(LPDIRECT3DBASETEXTURE8 iface) {
100     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
101     FIXME("(%p) : stub\n", This);
102 }
103 D3DRESOURCETYPE WINAPI IDirect3DBaseTexture8Impl_GetType(LPDIRECT3DBASETEXTURE8 iface) {
104     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
105     /*TRACE("(%p) : returning %d\n", This, This->ResourceType);*/
106     return This->ResourceType;
107 }
108
109 /* IDirect3DBaseTexture8 */
110 DWORD    WINAPI        IDirect3DBaseTexture8Impl_SetLOD(LPDIRECT3DBASETEXTURE8 iface, DWORD LODNew) {
111     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
112     FIXME("(%p) : stub\n", This);
113     return 0;
114 }
115 DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetLOD(LPDIRECT3DBASETEXTURE8 iface) {
116     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
117     FIXME("(%p) : stub\n", This);
118     return 0;
119 }
120 DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetLevelCount(LPDIRECT3DBASETEXTURE8 iface) {
121     ICOM_THIS(IDirect3DBaseTexture8Impl,iface);
122     FIXME("(%p) : stub\n", This);    
123     return 0;
124 }
125
126 ICOM_VTABLE(IDirect3DBaseTexture8) Direct3DBaseTexture8_Vtbl =
127 {
128     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
129     IDirect3DBaseTexture8Impl_QueryInterface,
130     IDirect3DBaseTexture8Impl_AddRef,
131     IDirect3DBaseTexture8Impl_Release,
132     IDirect3DBaseTexture8Impl_GetDevice,
133     IDirect3DBaseTexture8Impl_SetPrivateData,
134     IDirect3DBaseTexture8Impl_GetPrivateData,
135     IDirect3DBaseTexture8Impl_FreePrivateData,
136     IDirect3DBaseTexture8Impl_SetPriority,
137     IDirect3DBaseTexture8Impl_GetPriority,
138     IDirect3DBaseTexture8Impl_PreLoad,
139     IDirect3DBaseTexture8Impl_GetType,
140     IDirect3DBaseTexture8Impl_SetLOD,
141     IDirect3DBaseTexture8Impl_GetLOD,
142     IDirect3DBaseTexture8Impl_GetLevelCount,
143 };