1 | /*
|
---|
2 | * IDirect3DBaseTexture8 implementation
|
---|
3 | *
|
---|
4 | * Copyright 2005 Oliver Stieber
|
---|
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
19 | */
|
---|
20 |
|
---|
21 | /*
|
---|
22 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
23 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
24 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
25 | * a choice of LGPL license versions is made available with the language indicating
|
---|
26 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
27 | * of the LGPL is applied is otherwise unspecified.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #include "config.h"
|
---|
31 | #include "d3d8_private.h"
|
---|
32 |
|
---|
33 | WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
---|
34 |
|
---|
35 | /* IDirect3DBaseTexture8 IUnknown parts follow: */
|
---|
36 | static HRESULT WINAPI IDirect3DBaseTexture8Impl_QueryInterface(LPDIRECT3DBASETEXTURE8 iface, REFIID riid, LPVOID *ppobj) {
|
---|
37 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
38 | TRACE("(%p) Relay\n" , This);
|
---|
39 | if (IsEqualGUID(riid, &IID_IUnknown)
|
---|
40 | || IsEqualGUID(riid, &IID_IDirect3DResource8)
|
---|
41 | || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)) {
|
---|
42 | IUnknown_AddRef(iface);
|
---|
43 | *ppobj = This;
|
---|
44 | return S_OK;
|
---|
45 | }
|
---|
46 |
|
---|
47 | WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
---|
48 |
|
---|
49 | *ppobj = NULL;
|
---|
50 | return E_NOINTERFACE;
|
---|
51 | }
|
---|
52 |
|
---|
53 | static ULONG WINAPI IDirect3DBaseTexture8Impl_AddRef(LPDIRECT3DBASETEXTURE8 iface) {
|
---|
54 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
55 | ULONG ref = InterlockedIncrement(&This->ref);
|
---|
56 |
|
---|
57 | TRACE("(%p) : AddRef from %d\n", This, ref - 1);
|
---|
58 |
|
---|
59 | return ref;
|
---|
60 | }
|
---|
61 |
|
---|
62 | static ULONG WINAPI IDirect3DBaseTexture8Impl_Release(LPDIRECT3DBASETEXTURE8 iface) {
|
---|
63 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
64 | ULONG ref = InterlockedDecrement(&This->ref);
|
---|
65 |
|
---|
66 | TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
---|
67 |
|
---|
68 | if (ref == 0) {
|
---|
69 | IWineD3DBaseTexture_Release(This->wineD3DBaseTexture);
|
---|
70 | HeapFree(GetProcessHeap(), 0, This);
|
---|
71 | }
|
---|
72 |
|
---|
73 | return ref;
|
---|
74 | }
|
---|
75 |
|
---|
76 | /* IDirect3DBaseTexture8 IDirect3DResource8 Interface follow: */
|
---|
77 | static HRESULT WINAPI IDirect3DBaseTexture8Impl_GetDevice(LPDIRECT3DBASETEXTURE8 iface, IDirect3DDevice8 **ppDevice) {
|
---|
78 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
79 | TRACE("(%p) Relay\n" , This);
|
---|
80 |
|
---|
81 | return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
|
---|
82 | }
|
---|
83 |
|
---|
84 | static HRESULT WINAPI IDirect3DBaseTexture8Impl_SetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
---|
85 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
86 | TRACE("(%p) Relay\n" , This);
|
---|
87 |
|
---|
88 | return IWineD3DBaseTexture_SetPrivateData(This->wineD3DBaseTexture, refguid, pData, SizeOfData, Flags);
|
---|
89 | }
|
---|
90 |
|
---|
91 | static HRESULT WINAPI IDirect3DBaseTexture8Impl_GetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
---|
92 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
93 | TRACE("(%p) Relay\n" , This);
|
---|
94 |
|
---|
95 | return IWineD3DBaseTexture_GetPrivateData(This->wineD3DBaseTexture, refguid, pData, pSizeOfData);
|
---|
96 | }
|
---|
97 |
|
---|
98 | static HRESULT WINAPI IDirect3DBaseTexture8Impl_FreePrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid) {
|
---|
99 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
100 | TRACE("(%p) Relay\n" , This);
|
---|
101 |
|
---|
102 | return IWineD3DBaseTexture_FreePrivateData(This->wineD3DBaseTexture, refguid);
|
---|
103 | }
|
---|
104 |
|
---|
105 | static DWORD WINAPI IDirect3DBaseTexture8Impl_SetPriority(LPDIRECT3DBASETEXTURE8 iface, DWORD PriorityNew) {
|
---|
106 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
107 | TRACE("(%p) Relay\n" , This);
|
---|
108 |
|
---|
109 | return IWineD3DBaseTexture_SetPriority(This->wineD3DBaseTexture, PriorityNew);
|
---|
110 | }
|
---|
111 |
|
---|
112 | static DWORD WINAPI IDirect3DBaseTexture8Impl_GetPriority(LPDIRECT3DBASETEXTURE8 iface) {
|
---|
113 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
114 | TRACE("(%p) Relay\n" , This);
|
---|
115 |
|
---|
116 | return IWineD3DBaseTexture_GetPriority(This->wineD3DBaseTexture);
|
---|
117 | }
|
---|
118 |
|
---|
119 | static void WINAPI IDirect3DBaseTexture8Impl_PreLoad(LPDIRECT3DBASETEXTURE8 iface) {
|
---|
120 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
121 | TRACE("(%p) Relay\n" , This);
|
---|
122 |
|
---|
123 | IWineD3DBaseTexture_PreLoad(This->wineD3DBaseTexture);
|
---|
124 | return;
|
---|
125 | }
|
---|
126 |
|
---|
127 | static D3DRESOURCETYPE WINAPI IDirect3DBaseTexture8Impl_GetType(LPDIRECT3DBASETEXTURE8 iface) {
|
---|
128 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
129 | TRACE("(%p) Relay\n" , This);
|
---|
130 |
|
---|
131 | return IWineD3DBaseTexture_GetType(This->wineD3DBaseTexture);
|
---|
132 | }
|
---|
133 |
|
---|
134 | /* IDirect3DBaseTexture8 Interface follow: */
|
---|
135 | static DWORD WINAPI IDirect3DBaseTexture8Impl_SetLOD(LPDIRECT3DBASETEXTURE8 iface, DWORD LODNew) {
|
---|
136 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
137 | TRACE("(%p) Relay\n" , This);
|
---|
138 |
|
---|
139 | return IWineD3DBaseTexture_SetLOD(This->wineD3DBaseTexture, LODNew);
|
---|
140 | }
|
---|
141 |
|
---|
142 | static DWORD WINAPI IDirect3DBaseTexture8Impl_GetLOD(LPDIRECT3DBASETEXTURE8 iface) {
|
---|
143 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
144 | TRACE("(%p) Relay\n" , This);
|
---|
145 |
|
---|
146 | return IWineD3DBaseTexture_GetLOD(This->wineD3DBaseTexture);
|
---|
147 | }
|
---|
148 |
|
---|
149 | static DWORD WINAPI IDirect3DBaseTexture8Impl_GetLevelCount(LPDIRECT3DBASETEXTURE8 iface) {
|
---|
150 | IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
---|
151 | TRACE("(%p) Relay\n" , This);
|
---|
152 |
|
---|
153 | return IWineD3DBaseTexture_GetLevelCount(This->wineD3DBaseTexture);
|
---|
154 | }
|
---|
155 |
|
---|
156 | const IDirect3DBaseTexture8Vtbl Direct3DBaseTexture8_Vtbl =
|
---|
157 | {
|
---|
158 | IDirect3DBaseTexture8Impl_QueryInterface,
|
---|
159 | IDirect3DBaseTexture8Impl_AddRef,
|
---|
160 | IDirect3DBaseTexture8Impl_Release,
|
---|
161 | IDirect3DBaseTexture8Impl_GetDevice,
|
---|
162 | IDirect3DBaseTexture8Impl_SetPrivateData,
|
---|
163 | IDirect3DBaseTexture8Impl_GetPrivateData,
|
---|
164 | IDirect3DBaseTexture8Impl_FreePrivateData,
|
---|
165 | IDirect3DBaseTexture8Impl_SetPriority,
|
---|
166 | IDirect3DBaseTexture8Impl_GetPriority,
|
---|
167 | IDirect3DBaseTexture8Impl_PreLoad,
|
---|
168 | IDirect3DBaseTexture8Impl_GetType,
|
---|
169 |
|
---|
170 | IDirect3DBaseTexture8Impl_SetLOD,
|
---|
171 | IDirect3DBaseTexture8Impl_GetLOD,
|
---|
172 | IDirect3DBaseTexture8Impl_GetLevelCount
|
---|
173 | };
|
---|