Keep track of per-column information inside the listview.
[wine] / dlls / d3d8 / cubetexture.c
1 /*
2  * IDirect3DCubeTexture8 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 "windef.h"
22 #include "winbase.h"
23 #include "winuser.h"
24 #include "wingdi.h"
25 #include "wine/debug.h"
26
27 #include "d3d8_private.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
30
31 /* IDirect3DCubeTexture8 IUnknown parts follow: */
32 HRESULT WINAPI IDirect3DCubeTexture8Impl_QueryInterface(LPDIRECT3DCUBETEXTURE8 iface,REFIID riid,LPVOID *ppobj)
33 {
34     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
35     TRACE("(%p) : QueryInterface\n", This);
36     if (IsEqualGUID(riid, &IID_IUnknown)
37         || IsEqualGUID(riid, &IID_IClassFactory)) {
38         IDirect3DCubeTexture8Impl_AddRef(iface);
39         *ppobj = This;
40         return D3D_OK;
41     }
42
43     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
44     return E_NOINTERFACE;
45 }
46
47 ULONG WINAPI IDirect3DCubeTexture8Impl_AddRef(LPDIRECT3DCUBETEXTURE8 iface) {
48     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
49     TRACE("(%p) : AddRef from %ld\n", This, This->ref);
50     return ++(This->ref);
51 }
52
53 ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 iface) {
54     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
55     ULONG ref = --This->ref;
56     int i;
57
58     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
59     if (ref == 0) {
60         for (i=0; i<This->levels; i++) {
61             if (This->surfaces[i] != NULL) {
62                 TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[i]);
63                 IDirect3DSurface8Impl_Release((LPDIRECT3DSURFACE8) This->surfaces[i]);
64             }
65         }
66         HeapFree(GetProcessHeap(), 0, This);
67     }
68     return ref;
69 }
70
71 /* IDirect3DCubeTexture8 IDirect3DResource8 Interface follow: */
72 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetDevice(LPDIRECT3DCUBETEXTURE8 iface, IDirect3DDevice8** ppDevice) {
73     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
74     TRACE("(%p) : returning %p\n", This, This->Device);
75     *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
76     return D3D_OK;
77 }
78 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
79     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
80     FIXME("(%p) : stub\n", This);    return D3D_OK;
81 }
82 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
83     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
84     FIXME("(%p) : stub\n", This);    return D3D_OK;
85 }
86 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid) {
87     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
88     FIXME("(%p) : stub\n", This);    return D3D_OK;
89 }
90 DWORD    WINAPI        IDirect3DCubeTexture8Impl_SetPriority(LPDIRECT3DCUBETEXTURE8 iface, DWORD PriorityNew) {
91     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
92     FIXME("(%p) : stub\n", This);    return D3D_OK;
93 }
94 DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetPriority(LPDIRECT3DCUBETEXTURE8 iface) {
95     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
96     FIXME("(%p) : stub\n", This);    return D3D_OK;
97 }
98 void     WINAPI        IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8 iface) {
99     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
100     FIXME("(%p) : stub\n", This);
101 }
102
103 D3DRESOURCETYPE WINAPI IDirect3DCubeTexture8Impl_GetType(LPDIRECT3DCUBETEXTURE8 iface) {
104     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
105     TRACE("(%p) : returning %d\n", This, This->ResourceType);
106     return This->ResourceType;
107 }
108
109 /* IDirect3DCubeTexture8 (Inherited from IDirect3DBaseTexture8) */
110 DWORD    WINAPI        IDirect3DCubeTexture8Impl_SetLOD(LPDIRECT3DCUBETEXTURE8 iface, DWORD LODNew) {
111     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
112     FIXME("(%p) : stub\n", This);    return D3D_OK;
113 }
114 DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetLOD(LPDIRECT3DCUBETEXTURE8 iface) {
115     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
116     FIXME("(%p) : stub\n", This);    return D3D_OK;
117 }
118
119 DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE8 iface) {
120     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
121     TRACE("(%p) : returning %d\n", This, This->levels);
122     return This->levels;
123 }
124
125 /* IDirect3DCubeTexture8 */
126 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface,UINT Level,D3DSURFACE_DESC *pDesc) {
127     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
128     if (Level < This->levels) {
129         TRACE("(%p) Level (%d)\n", This, Level);
130         return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8)This->surfaces[Level], pDesc);
131     } else {
132         FIXME("(%p) Level (%d)\n", This, Level);
133     }
134     return D3D_OK;
135 }
136
137 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface8** ppCubeMapSurface) {
138     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
139     TRACE("(%p) : returning %p\n", This, This->surfaces[FaceType][Level]);
140     *ppCubeMapSurface = (LPDIRECT3DSURFACE8) This->surfaces[FaceType][Level];
141     IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8)This->surfaces[FaceType][Level]);
142     return D3D_OK;
143 }
144 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) {
145     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
146     FIXME("(%p) : stub\n", This);    return D3D_OK;
147 }
148 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level) {
149     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
150     This->Dirty = TRUE;
151     FIXME("(%p) : stub\n", This);    return D3D_OK;
152 }
153 HRESULT  WINAPI        IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) {
154     ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
155     This->Dirty = TRUE;
156     FIXME("(%p) : stub\n", This);    return D3D_OK;
157 }
158
159
160 ICOM_VTABLE(IDirect3DCubeTexture8) Direct3DCubeTexture8_Vtbl =
161 {
162     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
163     IDirect3DCubeTexture8Impl_QueryInterface,
164     IDirect3DCubeTexture8Impl_AddRef,
165     IDirect3DCubeTexture8Impl_Release,
166     IDirect3DCubeTexture8Impl_GetDevice,
167     IDirect3DCubeTexture8Impl_SetPrivateData,
168     IDirect3DCubeTexture8Impl_GetPrivateData,
169     IDirect3DCubeTexture8Impl_FreePrivateData,
170     IDirect3DCubeTexture8Impl_SetPriority,
171     IDirect3DCubeTexture8Impl_GetPriority,
172     IDirect3DCubeTexture8Impl_PreLoad,
173     IDirect3DCubeTexture8Impl_GetType,
174     IDirect3DCubeTexture8Impl_SetLOD,
175     IDirect3DCubeTexture8Impl_GetLOD,
176     IDirect3DCubeTexture8Impl_GetLevelCount,
177     IDirect3DCubeTexture8Impl_GetLevelDesc,
178     IDirect3DCubeTexture8Impl_GetCubeMapSurface,
179     IDirect3DCubeTexture8Impl_LockRect,
180     IDirect3DCubeTexture8Impl_UnlockRect,
181     IDirect3DCubeTexture8Impl_AddDirtyRect
182 };