2 * IDirect3DVolume8 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
27 #include "wine/debug.h"
29 #include "d3d8_private.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
33 /* IDirect3DVolume IUnknown parts follow: */
34 HRESULT WINAPI IDirect3DVolume8Impl_QueryInterface(LPDIRECT3DVOLUME8 iface,REFIID riid,LPVOID *ppobj)
36 ICOM_THIS(IDirect3DVolume8Impl,iface);
38 if (IsEqualGUID(riid, &IID_IUnknown)
39 || IsEqualGUID(riid, &IID_IDirect3DVolume8)) {
40 IDirect3DVolume8Impl_AddRef(iface);
45 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
49 ULONG WINAPI IDirect3DVolume8Impl_AddRef(LPDIRECT3DVOLUME8 iface) {
50 ICOM_THIS(IDirect3DVolume8Impl,iface);
51 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
55 ULONG WINAPI IDirect3DVolume8Impl_Release(LPDIRECT3DVOLUME8 iface) {
56 ICOM_THIS(IDirect3DVolume8Impl,iface);
57 ULONG ref = --This->ref;
58 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
60 HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
61 HeapFree(GetProcessHeap(), 0, This);
66 /* IDirect3DVolume8: */
67 HRESULT WINAPI IDirect3DVolume8Impl_GetDevice(LPDIRECT3DVOLUME8 iface, IDirect3DDevice8** ppDevice) {
68 ICOM_THIS(IDirect3DVolume8Impl,iface);
69 TRACE("(%p) : returning %p\n", This, This->Device);
70 *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
72 /* Note Calling this method will increase the internal reference count
73 on the IDirect3DDevice8 interface. */
74 IDirect3DDevice8Impl_AddRef(*ppDevice);
78 HRESULT WINAPI IDirect3DVolume8Impl_SetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
79 ICOM_THIS(IDirect3DVolume8Impl,iface);
80 FIXME("(%p) : stub\n", This); return D3D_OK;
82 HRESULT WINAPI IDirect3DVolume8Impl_GetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
83 ICOM_THIS(IDirect3DVolume8Impl,iface);
84 FIXME("(%p) : stub\n", This); return D3D_OK;
86 HRESULT WINAPI IDirect3DVolume8Impl_FreePrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid) {
87 ICOM_THIS(IDirect3DVolume8Impl,iface);
88 FIXME("(%p) : stub\n", This); return D3D_OK;
91 HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(LPDIRECT3DVOLUME8 iface, REFIID riid, void** ppContainer) {
92 ICOM_THIS(IDirect3DVolume8Impl,iface);
93 TRACE("(%p) : returning %p\n", This, This->Container);
94 *ppContainer = This->Container;
97 HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(LPDIRECT3DVOLUME8 iface, D3DVOLUME_DESC* pDesc) {
98 ICOM_THIS(IDirect3DVolume8Impl,iface);
99 TRACE("(%p) : copying into %p\n", This, pDesc);
100 memcpy(pDesc, &This->myDesc, sizeof(D3DVOLUME_DESC));
103 HRESULT WINAPI IDirect3DVolume8Impl_LockBox(LPDIRECT3DVOLUME8 iface, D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox, DWORD Flags) {
104 ICOM_THIS(IDirect3DVolume8Impl,iface);
105 FIXME("(%p) : pBox=%p stub\n", This, pBox);
107 /* fixme: should we really lock as such? */
108 TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->allocatedMemory);
110 pLockedVolume->RowPitch = This->bytesPerPixel * This->myDesc.Width; /* Bytes / row */
111 pLockedVolume->SlicePitch = This->bytesPerPixel * This->myDesc.Width * This->myDesc.Height; /* Bytes / slice */
113 TRACE("No box supplied - all is ok\n");
114 pLockedVolume->pBits = This->allocatedMemory;
116 TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", pBox, pBox->Left, pBox->Top,
117 pBox->Right, pBox->Bottom, pBox->Front, pBox->Back);
118 pLockedVolume->pBits = This->allocatedMemory +
119 (pLockedVolume->SlicePitch * pBox->Front) + /* FIXME: is front < back or vica versa? */
120 (pLockedVolume->RowPitch * pBox->Top) +
121 (pBox->Left * This->bytesPerPixel);
123 TRACE("returning pBits=%p, rpitch=%d, spitch=%d\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch);
130 HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(LPDIRECT3DVOLUME8 iface) {
131 ICOM_THIS(IDirect3DVolume8Impl,iface);
132 TRACE("(%p) : stub\n", This);
133 if (This->Container) {
134 IDirect3DVolumeTexture8 *cont = This->Container;
136 int containerType = IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) cont);
137 if (containerType == D3DRTYPE_VOLUMETEXTURE) {
138 IDirect3DTexture8Impl *pTexture = (IDirect3DTexture8Impl *)cont;
139 pTexture->Dirty = TRUE;
141 FIXME("Set dirty on container type %d\n", containerType);
148 ICOM_VTABLE(IDirect3DVolume8) Direct3DVolume8_Vtbl =
150 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
151 IDirect3DVolume8Impl_QueryInterface,
152 IDirect3DVolume8Impl_AddRef,
153 IDirect3DVolume8Impl_Release,
154 IDirect3DVolume8Impl_GetDevice,
155 IDirect3DVolume8Impl_SetPrivateData,
156 IDirect3DVolume8Impl_GetPrivateData,
157 IDirect3DVolume8Impl_FreePrivateData,
158 IDirect3DVolume8Impl_GetContainer,
159 IDirect3DVolume8Impl_GetDesc,
160 IDirect3DVolume8Impl_LockBox,
161 IDirect3DVolume8Impl_UnlockBox