[PATCH 5/5] d3dx9: Get rid of the ID3DXMatrixStack_Vtbl forward declaration.

Henri Verbeet hverbeet at codeweavers.com
Thu Aug 22 02:48:43 CDT 2013


---
 dlls/d3dx9_36/math.c | 68 +++++++++++++++++++++++++---------------------------
 1 file changed, 32 insertions(+), 36 deletions(-)

diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index e0cab9e..f6a43a0 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -35,8 +35,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
 
-static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl;
-
 struct ID3DXMatrixStackImpl
 {
   ID3DXMatrixStack ID3DXMatrixStack_iface;
@@ -47,6 +45,7 @@ struct ID3DXMatrixStackImpl
   D3DXMATRIX *stack;
 };
 
+static const unsigned int INITIAL_STACK_SIZE = 32;
 
 /*_________________D3DXColor____________________*/
 
@@ -930,40 +929,6 @@ D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, const D3DXMATRIX *pm)
 
 /*_________________D3DXMatrixStack____________________*/
 
-static const unsigned int INITIAL_STACK_SIZE = 32;
-
-HRESULT WINAPI D3DXCreateMatrixStack(DWORD flags, ID3DXMatrixStack **ppstack)
-{
-    struct ID3DXMatrixStackImpl *object;
-
-    TRACE("flags %#x, ppstack %p\n", flags, ppstack);
-
-    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
-    if (object == NULL)
-    {
-        *ppstack = NULL;
-        return E_OUTOFMEMORY;
-    }
-    object->ID3DXMatrixStack_iface.lpVtbl = &ID3DXMatrixStack_Vtbl;
-    object->ref = 1;
-
-    object->stack = HeapAlloc(GetProcessHeap(), 0, INITIAL_STACK_SIZE * sizeof(*object->stack));
-    if (!object->stack)
-    {
-        HeapFree(GetProcessHeap(), 0, object);
-        *ppstack = NULL;
-        return E_OUTOFMEMORY;
-    }
-
-    object->current = 0;
-    object->stack_size = INITIAL_STACK_SIZE;
-    D3DXMatrixIdentity(&object->stack[0]);
-
-    TRACE("Created matrix stack %p\n", object);
-
-    *ppstack = &object->ID3DXMatrixStack_iface;
-    return D3D_OK;
-}
 
 static inline struct ID3DXMatrixStackImpl *impl_from_ID3DXMatrixStack(ID3DXMatrixStack *iface)
 {
@@ -1243,6 +1208,37 @@ static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl =
     ID3DXMatrixStackImpl_GetTop
 };
 
+HRESULT WINAPI D3DXCreateMatrixStack(DWORD flags, ID3DXMatrixStack **stack)
+{
+    struct ID3DXMatrixStackImpl *object;
+
+    TRACE("flags %#x, stack %p.\n", flags, stack);
+
+    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    {
+        *stack = NULL;
+        return E_OUTOFMEMORY;
+    }
+    object->ID3DXMatrixStack_iface.lpVtbl = &ID3DXMatrixStack_Vtbl;
+    object->ref = 1;
+
+    if (!(object->stack = HeapAlloc(GetProcessHeap(), 0, INITIAL_STACK_SIZE * sizeof(*object->stack))))
+    {
+        HeapFree(GetProcessHeap(), 0, object);
+        *stack = NULL;
+        return E_OUTOFMEMORY;
+    }
+
+    object->current = 0;
+    object->stack_size = INITIAL_STACK_SIZE;
+    D3DXMatrixIdentity(&object->stack[0]);
+
+    TRACE("Created matrix stack %p.\n", object);
+
+    *stack = &object->ID3DXMatrixStack_iface;
+    return D3D_OK;
+}
+
 /*_________________D3DXPLANE________________*/
 
 D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, const D3DXVECTOR3 *pvpoint, const D3DXVECTOR3 *pvnormal)
-- 
1.8.1.5




More information about the wine-patches mailing list