[PATCH] d3dx9: Implement ID3DXFont_GetDevice

Tony Wasserka tony.wasserka at freenet.de
Fri Jun 5 06:15:44 CDT 2009


---
 dlls/d3dx9_36/d3dx9_36_private.h |    1 +
 dlls/d3dx9_36/font.c             |   10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx9_36/d3dx9_36_private.h b/dlls/d3dx9_36/d3dx9_36_private.h
index a2b0698..5891794 100644
--- a/dlls/d3dx9_36/d3dx9_36_private.h
+++ b/dlls/d3dx9_36/d3dx9_36_private.h
@@ -41,6 +41,7 @@ typedef struct ID3DXFontImpl
     LONG ref;
 
     /* ID3DXFont fields */
+    IDirect3DDevice9 *device;
 } ID3DXFontImpl;
 
 
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index e5e6569..e7f770c 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -55,6 +55,7 @@ static ULONG WINAPI ID3DXFontImpl_Release(LPD3DXFONT iface)
     TRACE("(%p): ReleaseRef to %d\n", This, ref);
 
     if(ref==0) {
+        IDirect3DDevice9_Release(This->device);
         HeapFree(GetProcessHeap(), 0, This);
     }
     return ref;
@@ -63,7 +64,12 @@ static ULONG WINAPI ID3DXFontImpl_Release(LPD3DXFONT iface)
 static HRESULT WINAPI ID3DXFontImpl_GetDevice(LPD3DXFONT iface, LPDIRECT3DDEVICE9 *device)
 {
     ID3DXFontImpl *This=(ID3DXFontImpl*)iface;
-    FIXME("(%p): stub\n", This);
+    TRACE("(%p)\n", This);
+
+    if( !device ) return D3DERR_INVALIDCALL;
+    *device = This->device;
+    IDirect3DDevice9_AddRef(This->device);
+
     return D3D_OK;
 }
 
@@ -282,7 +288,9 @@ HRESULT WINAPI D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_
     }
     object->lpVtbl=&D3DXFont_Vtbl;
     object->ref=1;
+    object->device=device;
 
+    IDirect3DDevice9_AddRef(device);
     *font=(LPD3DXFONT)object;
 
     return D3D_OK;
-- 
1.6.0.2


--------------040304010502000701010606--



More information about the wine-patches mailing list