2 * IDirect3DSurface9 implementation
4 * Copyright 2002-2003 Jason Edmeades
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.
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.
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
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
33 #include "wine/debug.h"
35 #include "d3d9_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
39 /* IDirect3DSurface9 IUnknown parts follow: */
40 HRESULT WINAPI IDirect3DSurface9Impl_QueryInterface(LPDIRECT3DSURFACE9 iface, REFIID riid, LPVOID* ppobj) {
41 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
43 if (IsEqualGUID(riid, &IID_IUnknown)
44 || IsEqualGUID(riid, &IID_IDirect3DResource9)
45 || IsEqualGUID(riid, &IID_IDirect3DSurface9)) {
46 IDirect3DSurface9Impl_AddRef(iface);
51 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
55 ULONG WINAPI IDirect3DSurface9Impl_AddRef(LPDIRECT3DSURFACE9 iface) {
56 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
57 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
61 ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) {
62 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
63 ULONG ref = --This->ref;
64 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
66 HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
67 HeapFree(GetProcessHeap(), 0, This);
72 /* IDirect3DSurface9 IDirect3DResource9 Interface follow: */
73 HRESULT WINAPI IDirect3DSurface9Impl_GetDevice(LPDIRECT3DSURFACE9 iface, IDirect3DDevice9** ppDevice) {
74 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
75 return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
78 HRESULT WINAPI IDirect3DSurface9Impl_SetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
79 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
80 FIXME("(%p) : stub\n", This);
84 HRESULT WINAPI IDirect3DSurface9Impl_GetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
85 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
86 FIXME("(%p) : stub\n", This);
90 HRESULT WINAPI IDirect3DSurface9Impl_FreePrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid) {
91 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
92 FIXME("(%p) : stub\n", This);
96 DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface, DWORD PriorityNew) {
97 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
98 return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
101 DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface) {
102 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
103 return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
106 void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) {
107 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
108 FIXME("(%p) : stub\n", This);
112 D3DRESOURCETYPE WINAPI IDirect3DSurface9Impl_GetType(LPDIRECT3DSURFACE9 iface) {
113 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
114 return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
117 /* IDirect3DSurface9 Interface follow: */
118 HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 iface, REFIID riid, void** ppContainer) {
119 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
121 res = IUnknown_QueryInterface(This->Container, riid, ppContainer);
122 if (E_NOINTERFACE == res) {
124 * If the surface is created using CreateImageSurface, CreateRenderTarget,
125 * or CreateDepthStencilSurface, the surface is considered stand alone. In this case,
126 * GetContainer will return the Direct3D device used to create the surface.
128 res = IUnknown_QueryInterface(This->Container, &IID_IDirect3DDevice9, ppContainer);
130 TRACE("(%p) : returning %p\n", This, *ppContainer);
134 HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) {
135 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
136 TRACE("(%p) : copying into %p\n", This, pDesc);
137 memcpy(pDesc, &This->myDesc, sizeof(D3DSURFACE_DESC));
141 HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
142 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
143 FIXME("(%p) : stub\n", This);
147 HRESULT WINAPI IDirect3DSurface9Impl_UnlockRect(LPDIRECT3DSURFACE9 iface) {
148 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
149 FIXME("(%p) : stub\n", This);
153 HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC* phdc) {
154 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
155 FIXME("(%p) : stub\n", This);
159 HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface, HDC hdc) {
160 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
161 FIXME("(%p) : stub\n", This);
166 IDirect3DSurface9Vtbl Direct3DSurface9_Vtbl =
168 IDirect3DSurface9Impl_QueryInterface,
169 IDirect3DSurface9Impl_AddRef,
170 IDirect3DSurface9Impl_Release,
171 IDirect3DSurface9Impl_GetDevice,
172 IDirect3DSurface9Impl_SetPrivateData,
173 IDirect3DSurface9Impl_GetPrivateData,
174 IDirect3DSurface9Impl_FreePrivateData,
175 IDirect3DSurface9Impl_SetPriority,
176 IDirect3DSurface9Impl_GetPriority,
177 IDirect3DSurface9Impl_PreLoad,
178 IDirect3DSurface9Impl_GetType,
179 IDirect3DSurface9Impl_GetContainer,
180 IDirect3DSurface9Impl_GetDesc,
181 IDirect3DSurface9Impl_LockRect,
182 IDirect3DSurface9Impl_UnlockRect,
183 IDirect3DSurface9Impl_GetDC,
184 IDirect3DSurface9Impl_ReleaseDC