Commit a6b9a637 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

dxgi: Implement IDXGISurface::GetDevice().

parent 4e29ade6
...@@ -274,7 +274,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa ...@@ -274,7 +274,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
hr = dxgi_surface_init(object, outer); hr = dxgi_surface_init(object, (IDXGIDevice *)iface, outer);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize surface, hr %#x.\n", hr); WARN("Failed to initialize surface, hr %#x.\n", hr);
......
...@@ -136,8 +136,9 @@ struct dxgi_surface ...@@ -136,8 +136,9 @@ struct dxgi_surface
const struct IUnknownVtbl *inner_unknown_vtbl; const struct IUnknownVtbl *inner_unknown_vtbl;
IUnknown *outer_unknown; IUnknown *outer_unknown;
LONG refcount; 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 */ #endif /* __WINE_DXGI_PRIVATE_H */
...@@ -72,6 +72,7 @@ static ULONG STDMETHODCALLTYPE dxgi_surface_inner_Release(IUnknown *iface) ...@@ -72,6 +72,7 @@ static ULONG STDMETHODCALLTYPE dxgi_surface_inner_Release(IUnknown *iface)
if (!refcount) if (!refcount)
{ {
IDXGIDevice_Release(This->device);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
...@@ -138,9 +139,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_GetParent(IDXGISurface *iface, REF ...@@ -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) 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 */ /* IDXGISurface methods */
...@@ -192,12 +195,14 @@ static const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl = ...@@ -192,12 +195,14 @@ static const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl =
dxgi_surface_inner_Release, 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->vtbl = &dxgi_surface_vtbl;
surface->inner_unknown_vtbl = &dxgi_surface_inner_unknown_vtbl; surface->inner_unknown_vtbl = &dxgi_surface_inner_unknown_vtbl;
surface->refcount = 1; surface->refcount = 1;
surface->outer_unknown = outer ? outer : (IUnknown *)&surface->inner_unknown_vtbl; surface->outer_unknown = outer ? outer : (IUnknown *)&surface->inner_unknown_vtbl;
surface->device = device;
IDXGIDevice_AddRef(device);
return S_OK; return S_OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment