Get rid of HEAP_strdupWtoA calls.
[wine/multimedia.git] / dlls / d3d9 / surface.c
blob07473723b6ae380e64134b34ea8d580dcd6e2ca4
1 /*
2 * IDirect3DSurface9 implementation
4 * Copyright 2002-2003 Jason Edmeades
5 * Raphael Junqueira
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
22 #include "config.h"
23 #include "d3d9_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
27 /* IDirect3DSurface9 IUnknown parts follow: */
28 HRESULT WINAPI IDirect3DSurface9Impl_QueryInterface(LPDIRECT3DSURFACE9 iface, REFIID riid, LPVOID* ppobj) {
29 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
31 if (IsEqualGUID(riid, &IID_IUnknown)
32 || IsEqualGUID(riid, &IID_IDirect3DResource9)
33 || IsEqualGUID(riid, &IID_IDirect3DSurface9)) {
34 IDirect3DSurface9Impl_AddRef(iface);
35 *ppobj = This;
36 return D3D_OK;
39 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
40 return E_NOINTERFACE;
43 ULONG WINAPI IDirect3DSurface9Impl_AddRef(LPDIRECT3DSURFACE9 iface) {
44 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
45 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
46 return ++(This->ref);
49 ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) {
50 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
51 ULONG ref = --This->ref;
52 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
53 if (ref == 0) {
54 HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
55 HeapFree(GetProcessHeap(), 0, This);
57 return ref;
60 /* IDirect3DSurface9 IDirect3DResource9 Interface follow: */
61 HRESULT WINAPI IDirect3DSurface9Impl_GetDevice(LPDIRECT3DSURFACE9 iface, IDirect3DDevice9** ppDevice) {
62 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
63 return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
66 HRESULT WINAPI IDirect3DSurface9Impl_SetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
67 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
68 FIXME("(%p) : stub\n", This);
69 return D3D_OK;
72 HRESULT WINAPI IDirect3DSurface9Impl_GetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
73 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
74 FIXME("(%p) : stub\n", This);
75 return D3D_OK;
78 HRESULT WINAPI IDirect3DSurface9Impl_FreePrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid) {
79 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
80 FIXME("(%p) : stub\n", This);
81 return D3D_OK;
84 DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface, DWORD PriorityNew) {
85 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
86 return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
89 DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface) {
90 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
91 return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
94 void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) {
95 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
96 FIXME("(%p) : stub\n", This);
97 return ;
100 D3DRESOURCETYPE WINAPI IDirect3DSurface9Impl_GetType(LPDIRECT3DSURFACE9 iface) {
101 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
102 return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
105 /* IDirect3DSurface9 Interface follow: */
106 HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 iface, REFIID riid, void** ppContainer) {
107 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
108 HRESULT res;
109 res = IUnknown_QueryInterface(This->Container, riid, ppContainer);
110 if (E_NOINTERFACE == res) {
112 * If the surface is created using CreateImageSurface, CreateRenderTarget,
113 * or CreateDepthStencilSurface, the surface is considered stand alone. In this case,
114 * GetContainer will return the Direct3D device used to create the surface.
116 res = IUnknown_QueryInterface(This->Container, &IID_IDirect3DDevice9, ppContainer);
118 TRACE("(%p) : returning %p\n", This, *ppContainer);
119 return res;
122 HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) {
123 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
124 TRACE("(%p) : copying into %p\n", This, pDesc);
125 memcpy(pDesc, &This->myDesc, sizeof(D3DSURFACE_DESC));
126 return D3D_OK;
129 HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
130 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
131 FIXME("(%p) : stub\n", This);
132 return D3D_OK;
135 HRESULT WINAPI IDirect3DSurface9Impl_UnlockRect(LPDIRECT3DSURFACE9 iface) {
136 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
137 FIXME("(%p) : stub\n", This);
138 return D3D_OK;
141 HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC* phdc) {
142 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
143 FIXME("(%p) : stub\n", This);
144 return D3D_OK;
147 HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface, HDC hdc) {
148 IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
149 FIXME("(%p) : stub\n", This);
150 return D3D_OK;
154 IDirect3DSurface9Vtbl Direct3DSurface9_Vtbl =
156 IDirect3DSurface9Impl_QueryInterface,
157 IDirect3DSurface9Impl_AddRef,
158 IDirect3DSurface9Impl_Release,
159 IDirect3DSurface9Impl_GetDevice,
160 IDirect3DSurface9Impl_SetPrivateData,
161 IDirect3DSurface9Impl_GetPrivateData,
162 IDirect3DSurface9Impl_FreePrivateData,
163 IDirect3DSurface9Impl_SetPriority,
164 IDirect3DSurface9Impl_GetPriority,
165 IDirect3DSurface9Impl_PreLoad,
166 IDirect3DSurface9Impl_GetType,
167 IDirect3DSurface9Impl_GetContainer,
168 IDirect3DSurface9Impl_GetDesc,
169 IDirect3DSurface9Impl_LockRect,
170 IDirect3DSurface9Impl_UnlockRect,
171 IDirect3DSurface9Impl_GetDC,
172 IDirect3DSurface9Impl_ReleaseDC