wined3d: Start of some surface cleanup.

This patch and the following intend to make the surface code more
manageable and are a preparation to add gl3 support. The code adds a
new IWineD3DBaseSurface surface type, which will contain the
non-rendering management code. IWineD3DSurface and IWineGDISurface
will be derived from IWineD3DBaseSurface, and IWineGL3Surface can be
added later.
This commit is contained in:
Stefan Dösinger 2007-09-16 13:29:44 +02:00 committed by Alexandre Julliard
parent 12b4930f96
commit 8434060b7e
5 changed files with 60 additions and 24 deletions

View File

@ -25,6 +25,7 @@ C_SRCS = \
resource.c \
state.c \
stateblock.c \
surface_base.c \
surface.c \
surface_gdi.c \
swapchain.c \

View File

@ -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 */

View File

@ -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;
}

View File

@ -1553,7 +1553,7 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
{
/* IUnknown */
IWineD3DSurfaceImpl_QueryInterface,
IWineD3DBaseSurfaceImpl_QueryInterface,
IWineD3DSurfaceImpl_AddRef,
IWineD3DSurfaceImpl_Release,
/* IWineD3DResource */

View File

@ -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);