wined3d: Move resource methods to the base surface class.
[wine/wine-kai.git] / dlls / wined3d / surface_base.c
blob6597d16e37029863cf20d1cb7ed6f41c91f85532
1 /*
2 * IWineD3DSurface Implementation of management(non-rendering) functions
4 * Copyright 1998 Lionel Ulmer
5 * Copyright 2000-2001 TransGaming Technologies Inc.
6 * Copyright 2002-2005 Jason Edmeades
7 * Copyright 2002-2003 Raphael Junqueira
8 * Copyright 2004 Christian Costa
9 * Copyright 2005 Oliver Stieber
10 * Copyright 2006 Stefan Dösinger for CodeWeavers
11 * Copyright 2007 Henri Verbeet
12 * Copyright 2006-2007 Roderick Colenbrander
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "config.h"
30 #include "wine/port.h"
31 #include "wined3d_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
35 /* Do NOT define GLINFO_LOCATION in this file. THIS CODE MUST NOT USE IT */
37 /* *******************************************
38 IWineD3DSurface IUnknown parts follow
39 ******************************************* */
40 HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, LPVOID *ppobj)
42 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
43 /* Warn ,but be nice about things */
44 TRACE("(%p)->(%s,%p)\n", This,debugstr_guid(riid),ppobj);
46 if (IsEqualGUID(riid, &IID_IUnknown)
47 || IsEqualGUID(riid, &IID_IWineD3DBase)
48 || IsEqualGUID(riid, &IID_IWineD3DResource)
49 || IsEqualGUID(riid, &IID_IWineD3DSurface)) {
50 IUnknown_AddRef((IUnknown*)iface);
51 *ppobj = This;
52 return S_OK;
54 *ppobj = NULL;
55 return E_NOINTERFACE;
58 ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface) {
59 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
60 ULONG ref = InterlockedIncrement(&This->resource.ref);
61 TRACE("(%p) : AddRef increasing from %d\n", This,ref - 1);
62 return ref;
65 /* ****************************************************
66 IWineD3DSurface IWineD3DResource parts follow
67 **************************************************** */
68 HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDevice(IWineD3DSurface *iface, IWineD3DDevice** ppDevice) {
69 return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice);
72 HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
73 return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
76 HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
77 return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
80 HRESULT WINAPI IWineD3DBaseSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid) {
81 return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid);
84 DWORD WINAPI IWineD3DBaseSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew) {
85 return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew);
88 DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPriority(IWineD3DSurface *iface) {
89 return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface);
92 WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *iface) {
93 TRACE("(%p) : calling resourceimpl_GetType\n", iface);
94 return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
97 HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) {
98 TRACE("(%p) : calling resourceimpl_GetParent\n", iface);
99 return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent);