Added tracing to all functions.
[wine] / dlls / d3d9 / volume.c
1 /*
2  * IDirect3DVolume9 implementation
3  *
4  * Copyright 2002-2003 Jason Edmeades
5  *                     Raphael Junqueira
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26 #include <stdarg.h>
27
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "wingdi.h"
32 #include "wine/debug.h"
33
34 #include "d3d9_private.h"
35
36 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
37
38 /* IDirect3DVolume9 IUnknown parts follow: */
39 HRESULT WINAPI IDirect3DVolume9Impl_QueryInterface(LPDIRECT3DVOLUME9 iface, REFIID riid, LPVOID* ppobj) {
40     ICOM_THIS(IDirect3DVolume9Impl,iface);
41
42     if (IsEqualGUID(riid, &IID_IUnknown)
43         || IsEqualGUID(riid, &IID_IDirect3DVolume9)) {
44         IDirect3DVolume9Impl_AddRef(iface);
45         *ppobj = This;
46         return D3D_OK;
47     }
48
49     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
50     return E_NOINTERFACE;
51 }
52
53 ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) {
54     ICOM_THIS(IDirect3DVolume9Impl,iface);
55     TRACE("(%p) : AddRef from %ld\n", This, This->ref);
56     return ++(This->ref);
57 }
58
59 ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) {
60     ICOM_THIS(IDirect3DVolume9Impl,iface);
61     ULONG ref = --This->ref;
62     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
63     if (ref == 0) {
64         HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
65         HeapFree(GetProcessHeap(), 0, This);
66     }
67     return ref;
68 }
69
70 /* IDirect3DVolume9 Interface follow: */
71 HRESULT WINAPI IDirect3DVolume9Impl_GetDevice(LPDIRECT3DVOLUME9 iface, IDirect3DDevice9** ppDevice) {
72     ICOM_THIS(IDirect3DVolume9Impl,iface);
73     TRACE("(%p) : returning %p\n", This, This->Device);
74     *ppDevice = (LPDIRECT3DDEVICE9) This->Device;
75
76     /* Note  Calling this method will increase the internal reference count 
77        on the IDirect3DDevice9 interface. */
78     IDirect3DDevice9Impl_AddRef(*ppDevice);
79
80     return D3D_OK;
81 }
82
83 HRESULT WINAPI IDirect3DVolume9Impl_SetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
84     ICOM_THIS(IDirect3DVolume9Impl,iface);
85     FIXME("(%p) : stub\n", This);    
86     return D3D_OK;
87 }
88
89 HRESULT WINAPI IDirect3DVolume9Impl_GetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID  refguid, void* pData, DWORD* pSizeOfData) {
90     ICOM_THIS(IDirect3DVolume9Impl,iface);
91     FIXME("(%p) : stub\n", This);    
92     return D3D_OK;
93 }
94
95 HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid) {
96     ICOM_THIS(IDirect3DVolume9Impl,iface);
97     FIXME("(%p) : stub\n", This);    
98     return D3D_OK;
99 }
100
101 HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, REFIID riid, void** ppContainer) {
102     ICOM_THIS(IDirect3DVolume9Impl,iface);
103     TRACE("(%p) : returning %p\n", This, This->Container);
104     *ppContainer = This->Container;
105     IUnknown_AddRef(This->Container);
106     return D3D_OK;
107 }
108
109 HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DVOLUME_DESC* pDesc) {
110     ICOM_THIS(IDirect3DVolume9Impl,iface);
111     TRACE("(%p) : copying into %p\n", This, pDesc);
112     memcpy(pDesc, &This->myDesc, sizeof(D3DVOLUME_DESC));
113     return D3D_OK;
114 }
115
116 HRESULT WINAPI IDirect3DVolume9Impl_LockBox(LPDIRECT3DVOLUME9 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
117     ICOM_THIS(IDirect3DVolume9Impl,iface);
118     FIXME("(%p) : stub\n", This);    
119     return D3D_OK;
120 }
121
122 HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) {
123     ICOM_THIS(IDirect3DVolume9Impl,iface);
124     FIXME("(%p) : stub\n", This);    
125     return D3D_OK;
126 }
127
128
129 ICOM_VTABLE(IDirect3DVolume9) Direct3DVolume9_Vtbl =
130 {
131     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
132     IDirect3DVolume9Impl_QueryInterface,
133     IDirect3DVolume9Impl_AddRef,
134     IDirect3DVolume9Impl_Release,
135     IDirect3DVolume9Impl_GetDevice,
136     IDirect3DVolume9Impl_SetPrivateData,
137     IDirect3DVolume9Impl_GetPrivateData,
138     IDirect3DVolume9Impl_FreePrivateData,
139     IDirect3DVolume9Impl_GetContainer,
140     IDirect3DVolume9Impl_GetDesc,
141     IDirect3DVolume9Impl_LockBox,
142     IDirect3DVolume9Impl_UnlockBox
143 };