[PATCH 4/5] dxgi: Implement IDXGISurface::GetDevice().

Henri Verbeet hverbeet at codeweavers.com
Mon Dec 7 04:08:39 CST 2009


---
 dlls/dxgi/device.c       |    2 +-
 dlls/dxgi/dxgi_private.h |    3 ++-
 dlls/dxgi/surface.c      |   11 ++++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index 7860d0c..eddb1e4 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -274,7 +274,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
         return E_OUTOFMEMORY;
     }
 
-    hr = dxgi_surface_init(object, outer);
+    hr = dxgi_surface_init(object, (IDXGIDevice *)iface, outer);
     if (FAILED(hr))
     {
         WARN("Failed to initialize surface, hr %#x.\n", hr);
diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h
index 69c9f6c..6151800 100644
--- a/dlls/dxgi/dxgi_private.h
+++ b/dlls/dxgi/dxgi_private.h
@@ -136,8 +136,9 @@ struct dxgi_surface
     const struct IUnknownVtbl *inner_unknown_vtbl;
     IUnknown *outer_unknown;
     LONG refcount;
+    IDXGIDevice *device;
 };
 
-HRESULT dxgi_surface_init(struct dxgi_surface *surface, IUnknown *outer) DECLSPEC_HIDDEN;
+HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device, IUnknown *outer) DECLSPEC_HIDDEN;
 
 #endif /* __WINE_DXGI_PRIVATE_H */
diff --git a/dlls/dxgi/surface.c b/dlls/dxgi/surface.c
index 1e5038b..0d9aef1 100644
--- a/dlls/dxgi/surface.c
+++ b/dlls/dxgi/surface.c
@@ -72,6 +72,7 @@ static ULONG STDMETHODCALLTYPE dxgi_surface_inner_Release(IUnknown *iface)
 
     if (!refcount)
     {
+        IDXGIDevice_Release(This->device);
         HeapFree(GetProcessHeap(), 0, This);
     }
 
@@ -138,9 +139,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_GetParent(IDXGISurface *iface, REF
 
 static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDevice(IDXGISurface *iface, REFIID riid, void **device)
 {
-    FIXME("iface %p, riid %s, device %p stub!\n", iface, debugstr_guid(riid), device);
+    struct dxgi_surface *This = (struct dxgi_surface *)iface;
 
-    return E_NOTIMPL;
+    TRACE("iface %p, riid %s, device %p.\n", iface, debugstr_guid(riid), device);
+
+    return IDXGIDevice_QueryInterface(This->device, riid, device);
 }
 
 /* IDXGISurface methods */
@@ -192,12 +195,14 @@ static const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl =
     dxgi_surface_inner_Release,
 };
 
-HRESULT dxgi_surface_init(struct dxgi_surface *surface, IUnknown *outer)
+HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device, IUnknown *outer)
 {
     surface->vtbl = &dxgi_surface_vtbl;
     surface->inner_unknown_vtbl = &dxgi_surface_inner_unknown_vtbl;
     surface->refcount = 1;
     surface->outer_unknown = outer ? outer : (IUnknown *)&surface->inner_unknown_vtbl;
+    surface->device = device;
+    IDXGIDevice_AddRef(device);
 
     return S_OK;
 }
-- 
1.6.4.4




More information about the wine-patches mailing list