Markus Amsler : d3d8: Backport IDirect3DVolume9Impl_GetContainer.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 9 06:09:10 CST 2006


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

Author: Markus Amsler <markus.amsler at oribi.org>
Date:   Thu Nov  9 02:38:41 2006 +0100

d3d8: Backport IDirect3DVolume9Impl_GetContainer.

---

 dlls/d3d8/volume.c |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c
index 4e3350b..9619b35 100644
--- a/dlls/d3d8/volume.c
+++ b/dlls/d3d8/volume.c
@@ -115,18 +115,38 @@ static HRESULT WINAPI IDirect3DVolume8Im
 
 static HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(LPDIRECT3DVOLUME8 iface, REFIID riid, void **ppContainer) {
     IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface;
+    IWineD3DBase *wineD3DContainer = NULL;
+    IUnknown *wineD3DContainerParent = NULL;
     HRESULT res;
-    IUnknown *IWineContainer = NULL;
 
-    TRACE("(%p) Relay\n", This);
-    res = IWineD3DVolume_GetContainer(This->wineD3DVolume, riid, (void **)&IWineContainer);
+    TRACE("(This %p, riid %s, ppContainer %p)\n", This, debugstr_guid(riid), ppContainer);
 
-    /* If this works, the only valid container is a child of resource (volumetexture) */
-    if (res == D3D_OK && NULL != ppContainer) {
-        IWineD3DResource_GetParent((IWineD3DResource *)IWineContainer, (IUnknown **)ppContainer);
-        IWineD3DResource_Release((IWineD3DResource *)IWineContainer);
+    if (!ppContainer) {
+        ERR("Called without a valid ppContainer.\n");
     }
 
+    /* Get the WineD3D container. */
+    res = IWineD3DVolume_GetContainer(This->wineD3DVolume, &IID_IWineD3DBase, (void **)&wineD3DContainer);
+    if (res != D3D_OK) return res;
+
+    if (!wineD3DContainer) {
+        ERR("IWineD3DSurface_GetContainer should never return NULL\n");
+    }
+
+    /* Get the parent */
+    IWineD3DBase_GetParent(wineD3DContainer, &wineD3DContainerParent);
+    IUnknown_Release(wineD3DContainer);
+
+    if (!wineD3DContainerParent) {
+        ERR("IWineD3DBase_GetParent should never return NULL\n");
+    }
+
+    /* Now, query the interface of the parent for the riid */
+    res = IUnknown_QueryInterface(wineD3DContainerParent, riid, ppContainer);
+    IUnknown_Release(wineD3DContainerParent);
+
+    TRACE("Returning ppContainer %p, *ppContainer %p\n", ppContainer, *ppContainer);
+
     return res;
 }
 




More information about the wine-cvs mailing list