Dylan Smith : d3dx9: Implement D3DXFrameDestroy.

Alexandre Julliard julliard at winehq.org
Fri May 20 12:44:31 CDT 2011


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

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Thu May 19 04:02:29 2011 -0400

d3dx9: Implement D3DXFrameDestroy.

---

 dlls/d3dx9_36/d3dx9_36.spec |    2 +-
 dlls/d3dx9_36/mesh.c        |   43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec
index 437e9b2..80f34e2 100644
--- a/dlls/d3dx9_36/d3dx9_36.spec
+++ b/dlls/d3dx9_36/d3dx9_36.spec
@@ -134,7 +134,7 @@
 @ stub D3DXFloat32To16Array(ptr ptr long)
 @ stub D3DXFrameAppendChild(ptr ptr)
 @ stub D3DXFrameCalculateBoundingSphere(ptr ptr ptr)
-@ stub D3DXFrameDestroy(ptr ptr)
+@ stdcall D3DXFrameDestroy(ptr ptr)
 @ stub D3DXFrameFind(ptr ptr)
 @ stub D3DXFrameNumNamedMatrices(ptr)
 @ stub D3DXFrameRegisterNamedMatrices(ptr ptr)
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index b5504d5..c5954b3 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -1808,6 +1808,49 @@ HRESULT WINAPI D3DXCreateMeshFVF(DWORD numfaces, DWORD numvertices, DWORD option
     return D3DXCreateMesh(numfaces, numvertices, options, declaration, device, mesh);
 }
 
+
+HRESULT WINAPI D3DXFrameDestroy(LPD3DXFRAME frame, LPD3DXALLOCATEHIERARCHY alloc_hier)
+{
+    HRESULT hr;
+    BOOL last = FALSE;
+
+    TRACE("(%p, %p)\n", frame, alloc_hier);
+
+    if (!frame || !alloc_hier)
+        return D3DERR_INVALIDCALL;
+
+    while (!last) {
+        D3DXMESHCONTAINER *container;
+        D3DXFRAME *current_frame;
+
+        if (frame->pFrameSibling) {
+            current_frame = frame->pFrameSibling;
+            frame->pFrameSibling = current_frame->pFrameSibling;
+            current_frame->pFrameSibling = NULL;
+        } else if (frame) {
+            current_frame = frame;
+            last = TRUE;
+        }
+
+        if (current_frame->pFrameFirstChild) {
+            hr = D3DXFrameDestroy(current_frame->pFrameFirstChild, alloc_hier);
+            if (FAILED(hr)) return hr;
+            current_frame->pFrameFirstChild = NULL;
+        }
+
+        container = current_frame->pMeshContainer;
+        while (container) {
+            D3DXMESHCONTAINER *next_container = container->pNextMeshContainer;
+            hr = alloc_hier->lpVtbl->DestroyMeshContainer(alloc_hier, container);
+            if (FAILED(hr)) return hr;
+            container = next_container;
+        }
+        hr = alloc_hier->lpVtbl->DestroyFrame(alloc_hier, current_frame);
+        if (FAILED(hr)) return hr;
+    }
+    return D3D_OK;
+}
+
 HRESULT WINAPI D3DXCreateBox(LPDIRECT3DDEVICE9 device, FLOAT width, FLOAT height,
                              FLOAT depth, LPD3DXMESH* mesh, LPD3DXBUFFER* adjacency)
 {




More information about the wine-cvs mailing list