dxgi: Implement IDXGISurface::GetDevice().

This commit is contained in:
Henri Verbeet 2009-12-07 11:08:39 +01:00 committed by Alexandre Julliard
parent 4e29ade658
commit a6b9a637e2
3 changed files with 11 additions and 5 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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;
}