diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in index 16587b3ba88..9ec6494a53a 100644 --- a/dlls/wined3d/Makefile.in +++ b/dlls/wined3d/Makefile.in @@ -25,6 +25,7 @@ C_SRCS = \ resource.c \ state.c \ stateblock.c \ + surface_base.c \ surface.c \ surface_gdi.c \ swapchain.c \ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 7bad3d7b69c..f3a2142c67a 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -334,27 +334,6 @@ GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain *swapchai return GL_BACK; } -/* ******************************************* - IWineD3DSurface IUnknown parts follow - ******************************************* */ -HRESULT WINAPI IWineD3DSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, LPVOID *ppobj) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - /* Warn ,but be nice about things */ - TRACE("(%p)->(%s,%p)\n", This,debugstr_guid(riid),ppobj); - - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IWineD3DResource) - || IsEqualGUID(riid, &IID_IWineD3DSurface)) { - IUnknown_AddRef((IUnknown*)iface); - *ppobj = This; - return S_OK; - } - *ppobj = NULL; - return E_NOINTERFACE; -} - ULONG WINAPI IWineD3DSurfaceImpl_AddRef(IWineD3DSurface *iface) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; ULONG ref = InterlockedIncrement(&This->resource.ref); @@ -4030,7 +4009,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD3DCl const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl = { /* IUnknown */ - IWineD3DSurfaceImpl_QueryInterface, + IWineD3DBaseSurfaceImpl_QueryInterface, IWineD3DSurfaceImpl_AddRef, IWineD3DSurfaceImpl_Release, /* IWineD3DResource */ diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c new file mode 100644 index 00000000000..48cad48fb21 --- /dev/null +++ b/dlls/wined3d/surface_base.c @@ -0,0 +1,56 @@ +/* + * IWineD3DSurface Implementation of management(non-rendering) functions + * + * Copyright 1998 Lionel Ulmer + * Copyright 2000-2001 TransGaming Technologies Inc. + * Copyright 2002-2005 Jason Edmeades + * Copyright 2002-2003 Raphael Junqueira + * Copyright 2004 Christian Costa + * Copyright 2005 Oliver Stieber + * Copyright 2006 Stefan Dösinger for CodeWeavers + * Copyright 2007 Henri Verbeet + * Copyright 2006-2007 Roderick Colenbrander + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" +#include "wine/port.h" +#include "wined3d_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); + +/* Do NOT define GLINFO_LOCATION in this file. THIS CODE MUST NOT USE IT */ + +/* ******************************************* + IWineD3DSurface IUnknown parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, LPVOID *ppobj) +{ + IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; + /* Warn ,but be nice about things */ + TRACE("(%p)->(%s,%p)\n", This,debugstr_guid(riid),ppobj); + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IWineD3DBase) + || IsEqualGUID(riid, &IID_IWineD3DResource) + || IsEqualGUID(riid, &IID_IWineD3DSurface)) { + IUnknown_AddRef((IUnknown*)iface); + *ppobj = This; + return S_OK; + } + *ppobj = NULL; + return E_NOINTERFACE; +} diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c index 9f498825cdc..3ba49f1bc5e 100644 --- a/dlls/wined3d/surface_gdi.c +++ b/dlls/wined3d/surface_gdi.c @@ -1553,7 +1553,7 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface) const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl = { /* IUnknown */ - IWineD3DSurfaceImpl_QueryInterface, + IWineD3DBaseSurfaceImpl_QueryInterface, IWineD3DSurfaceImpl_AddRef, IWineD3DSurfaceImpl_Release, /* IWineD3DResource */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 86b11de1292..c69bf40de9d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1140,7 +1140,7 @@ extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl; extern const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl; /* Predeclare the shared Surface functions */ -HRESULT WINAPI IWineD3DSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, LPVOID *ppobj); +HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, LPVOID *ppobj); ULONG WINAPI IWineD3DSurfaceImpl_AddRef(IWineD3DSurface *iface); ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface); HRESULT WINAPI IWineD3DSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent);