Commit a26925d3 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dxgi: COM cleanup for the IWineDXGIFactory iface.

parent e3a32e8d
...@@ -77,7 +77,7 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSP ...@@ -77,7 +77,7 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSP
/* IDXGIFactory */ /* IDXGIFactory */
struct dxgi_factory struct dxgi_factory
{ {
const struct IWineDXGIFactoryVtbl *vtbl; IWineDXGIFactory IWineDXGIFactory_iface;
LONG refcount; LONG refcount;
struct wined3d *wined3d; struct wined3d *wined3d;
UINT adapter_count; UINT adapter_count;
......
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(dxgi); WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
static inline struct dxgi_factory *impl_from_IWineDXGIFactory(IWineDXGIFactory *iface)
{
return CONTAINING_RECORD(iface, struct dxgi_factory, IWineDXGIFactory_iface);
}
/* IUnknown methods */ /* IUnknown methods */
static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IWineDXGIFactory *iface, REFIID riid, void **object) static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IWineDXGIFactory *iface, REFIID riid, void **object)
...@@ -48,7 +53,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IWineDXGIFactory *i ...@@ -48,7 +53,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IWineDXGIFactory *i
static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IWineDXGIFactory *iface) static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IWineDXGIFactory *iface)
{ {
struct dxgi_factory *This = (struct dxgi_factory *)iface; struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface);
ULONG refcount = InterlockedIncrement(&This->refcount); ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u\n", This, refcount); TRACE("%p increasing refcount to %u\n", This, refcount);
...@@ -58,7 +63,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IWineDXGIFactory *iface) ...@@ -58,7 +63,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IWineDXGIFactory *iface)
static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface) static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface)
{ {
struct dxgi_factory *This = (struct dxgi_factory *)iface; struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface);
ULONG refcount = InterlockedDecrement(&This->refcount); ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u\n", This, refcount); TRACE("%p decreasing refcount to %u\n", This, refcount);
...@@ -122,7 +127,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IWineDXGIFactory *iface, ...@@ -122,7 +127,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IWineDXGIFactory *iface,
static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface, static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface,
UINT adapter_idx, IDXGIAdapter **adapter) UINT adapter_idx, IDXGIAdapter **adapter)
{ {
struct dxgi_factory *This = (struct dxgi_factory *)iface; struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface);
TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter); TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter);
...@@ -258,7 +263,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFac ...@@ -258,7 +263,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFac
static struct wined3d * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *iface) static struct wined3d * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *iface)
{ {
struct dxgi_factory *This = (struct dxgi_factory *)iface; struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface);
TRACE("iface %p\n", iface); TRACE("iface %p\n", iface);
...@@ -294,7 +299,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory) ...@@ -294,7 +299,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory)
HRESULT hr; HRESULT hr;
UINT i; UINT i;
factory->vtbl = &dxgi_factory_vtbl; factory->IWineDXGIFactory_iface.lpVtbl = &dxgi_factory_vtbl;
factory->refcount = 1; factory->refcount = 1;
EnterCriticalSection(&dxgi_cs); EnterCriticalSection(&dxgi_cs);
...@@ -332,7 +337,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory) ...@@ -332,7 +337,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory)
goto fail; goto fail;
} }
hr = dxgi_adapter_init(adapter, (IWineDXGIFactory *)factory, i); hr = dxgi_adapter_init(adapter, &factory->IWineDXGIFactory_iface, i);
if (FAILED(hr)) if (FAILED(hr))
{ {
UINT j; UINT j;
......
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