Added YUV routines needed for v4l driver, and in the future possibly
[wine/gsoc-2012-control.git] / dlls / d3d8 / basetexture.c
blob2b45e622ea85fda277859e5729fc989fa37d4ea5
1 /*
2 * IDirect3DBaseTexture8 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
21 #include "config.h"
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "wingdi.h"
29 #include "wine/debug.h"
31 #include "d3d8_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
35 /* IDirect3DBaseTexture8 (Inherited from IUnknown) */
36 HRESULT WINAPI IDirect3DBaseTexture8Impl_QueryInterface(LPDIRECT3DBASETEXTURE8 iface,REFIID riid,LPVOID *ppobj)
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;
48 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
49 return E_NOINTERFACE;
52 ULONG WINAPI IDirect3DBaseTexture8Impl_AddRef(LPDIRECT3DBASETEXTURE8 iface) {
53 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
54 ULONG ref = InterlockedIncrement(&This->ref);
56 TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
58 return ref;
61 ULONG WINAPI IDirect3DBaseTexture8Impl_Release(LPDIRECT3DBASETEXTURE8 iface) {
62 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
63 ULONG ref = InterlockedDecrement(&This->ref);
65 TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
67 if (ref == 0)
68 HeapFree(GetProcessHeap(), 0, This);
69 return ref;
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.
81 IDirect3DDevice8Impl_AddRef(*ppDevice);
82 return D3D_OK;
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;
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;
92 HRESULT WINAPI IDirect3DBaseTexture8Impl_FreePrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid) {
93 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
94 FIXME("(%p) : stub\n", This); return D3D_OK;
96 DWORD WINAPI IDirect3DBaseTexture8Impl_SetPriority(LPDIRECT3DBASETEXTURE8 iface, DWORD PriorityNew) {
97 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
98 FIXME("(%p) : stub\n", This);
99 return 0;
101 DWORD WINAPI IDirect3DBaseTexture8Impl_GetPriority(LPDIRECT3DBASETEXTURE8 iface) {
102 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
103 FIXME("(%p) : stub\n", This);
104 return 0;
106 void WINAPI IDirect3DBaseTexture8Impl_PreLoad(LPDIRECT3DBASETEXTURE8 iface) {
107 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
108 FIXME("(%p) : stub\n", This);
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;
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;
122 DWORD WINAPI IDirect3DBaseTexture8Impl_GetLOD(LPDIRECT3DBASETEXTURE8 iface) {
123 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
124 FIXME("(%p) : stub\n", This);
125 return 0;
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;
133 IDirect3DBaseTexture8Vtbl Direct3DBaseTexture8_Vtbl =
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,
151 BOOL WINAPI IDirect3DBaseTexture8Impl_IsDirty(LPDIRECT3DBASETEXTURE8 iface) {
152 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
153 return This->Dirty;
156 BOOL WINAPI IDirect3DBaseTexture8Impl_SetDirty(LPDIRECT3DBASETEXTURE8 iface, BOOL dirty) {
157 BOOL old;
158 IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
160 old = This->Dirty;
161 This->Dirty = dirty;
162 return old;