Henri Verbeet : dxgi: Implement IDXGISurface::GetParent().

Alexandre Julliard julliard at winehq.org
Mon Dec 7 10:26:19 CST 2009


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Dec  7 11:08:40 2009 +0100

dxgi: Implement IDXGISurface::GetParent().

---

 dlls/dxgi/surface.c      |    6 ++++--
 dlls/dxgi/tests/device.c |   17 +++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/dxgi/surface.c b/dlls/dxgi/surface.c
index 0d9aef1..6296c1a 100644
--- a/dlls/dxgi/surface.c
+++ b/dlls/dxgi/surface.c
@@ -130,9 +130,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_GetPrivateData(IDXGISurface *iface
 
 static HRESULT STDMETHODCALLTYPE dxgi_surface_GetParent(IDXGISurface *iface, REFIID riid, void **parent)
 {
-    FIXME("iface %p, riid %s, parent %p stub!\n", iface, debugstr_guid(riid), parent);
+    struct dxgi_surface *This = (struct dxgi_surface *)iface;
 
-    return E_NOTIMPL;
+    TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);
+
+    return IDXGIDevice_QueryInterface(This->device, riid, parent);
 }
 
 /* IDXGIDeviceSubObject methods */
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index 32e87e6..2391c1b 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -153,12 +153,29 @@ static void test_create_surface(IDXGIDevice *device)
 
 static void test_parents(IDXGIDevice *device)
 {
+    DXGI_SURFACE_DESC surface_desc;
+    IDXGISurface *surface;
     IDXGIFactory *factory;
     IDXGIAdapter *adapter;
     IDXGIOutput *output;
     IUnknown *parent;
     HRESULT hr;
 
+    surface_desc.Width = 512;
+    surface_desc.Height = 512;
+    surface_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+    surface_desc.SampleDesc.Count = 1;
+    surface_desc.SampleDesc.Quality = 0;
+
+    hr = IDXGIDevice_CreateSurface(device, &surface_desc, 1, DXGI_USAGE_RENDER_TARGET_OUTPUT, NULL, &surface);
+    ok(SUCCEEDED(hr), "Failed to create a dxgi surface, hr %#x\n", hr);
+
+    hr = IDXGISurface_GetParent(surface, &IID_IDXGIDevice, (void **)&parent);
+    IDXGISurface_Release(surface);
+    ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
+    ok(parent == (IUnknown *)device, "Got parent %p, expected %p.\n", parent, device);
+    IUnknown_Release(parent);
+
     hr = IDXGIDevice_GetAdapter(device, &adapter);
     ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
 




More information about the wine-cvs mailing list