Stefan Dösinger : wined3d: Start of some surface cleanup.

Alexandre Julliard julliard at winehq.org
Tue Sep 18 05:30:59 CDT 2007


Module: wine
Branch: master
Commit: 8434060b7ec2e32758f43935196f6182d881575e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8434060b7ec2e32758f43935196f6182d881575e

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sun Sep 16 13:29:44 2007 +0200

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.

---

 dlls/wined3d/Makefile.in       |    1 +
 dlls/wined3d/surface.c         |   23 +---------------
 dlls/wined3d/surface_base.c    |   56 ++++++++++++++++++++++++++++++++++++++++
 dlls/wined3d/surface_gdi.c     |    2 +-
 dlls/wined3d/wined3d_private.h |    2 +-
 5 files changed, 60 insertions(+), 24 deletions(-)

diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in
index 16587b3..9ec6494 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 7bad3d7..f3a2142 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 0000000..48cad48
--- /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 9f49882..3ba49f1 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 86b11de..c69bf40 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);




More information about the wine-cvs mailing list