d3d8: Finish the COM cleanup of the IDirect3DDevice8 iface.

This commit is contained in:
Michael Stefaniuc 2011-01-28 01:17:54 +01:00 committed by Alexandre Julliard
parent dec337acac
commit 54a61ae734
9 changed files with 19 additions and 19 deletions

View File

@ -277,7 +277,7 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im
return hr; return hr;
} }
buffer->parentDevice = (IDirect3DDevice8 *)device; buffer->parentDevice = &device->IDirect3DDevice8_iface;
IUnknown_AddRef(buffer->parentDevice); IUnknown_AddRef(buffer->parentDevice);
return D3D_OK; return D3D_OK;
@ -538,7 +538,7 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl
return hr; return hr;
} }
buffer->parentDevice = (IDirect3DDevice8 *)device; buffer->parentDevice = &device->IDirect3DDevice8_iface;
IUnknown_AddRef(buffer->parentDevice); IUnknown_AddRef(buffer->parentDevice);
return D3D_OK; return D3D_OK;

View File

@ -382,7 +382,7 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp
return hr; return hr;
} }
texture->parentDevice = (IDirect3DDevice8 *)device; texture->parentDevice = &device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(texture->parentDevice); IDirect3DDevice8_AddRef(texture->parentDevice);
return D3D_OK; return D3D_OK;

View File

@ -177,7 +177,7 @@ struct FvfToDecl
struct IDirect3DDevice8Impl struct IDirect3DDevice8Impl
{ {
/* IUnknown fields */ /* IUnknown fields */
const IDirect3DDevice8Vtbl *lpVtbl; IDirect3DDevice8 IDirect3DDevice8_iface;
const IWineD3DDeviceParentVtbl *device_parent_vtbl; const IWineD3DDeviceParentVtbl *device_parent_vtbl;
LONG ref; LONG ref;
/* But what about baseVertexIndex in state blocks? hmm... it may be a better idea to pass this to wined3d */ /* But what about baseVertexIndex in state blocks? hmm... it may be a better idea to pass this to wined3d */

View File

@ -266,7 +266,7 @@ static ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
static inline IDirect3DDevice8Impl *impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface) static inline IDirect3DDevice8Impl *impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
{ {
return CONTAINING_RECORD(iface, IDirect3DDevice8Impl, lpVtbl); return CONTAINING_RECORD(iface, IDirect3DDevice8Impl, IDirect3DDevice8_iface);
} }
static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(IDirect3DDevice8 *iface, REFIID riid, static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(IDirect3DDevice8 *iface, REFIID riid,
@ -2724,19 +2724,19 @@ static inline struct IDirect3DDevice8Impl *device_from_device_parent(IWineD3DDev
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object) static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
{ {
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
return IDirect3DDevice8Impl_QueryInterface((IDirect3DDevice8 *)This, riid, object); return IDirect3DDevice8Impl_QueryInterface(&This->IDirect3DDevice8_iface, riid, object);
} }
static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface) static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
{ {
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
return IDirect3DDevice8Impl_AddRef((IDirect3DDevice8 *)This); return IDirect3DDevice8Impl_AddRef(&This->IDirect3DDevice8_iface);
} }
static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface) static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
{ {
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
return IDirect3DDevice8Impl_Release((IDirect3DDevice8 *)This); return IDirect3DDevice8Impl_Release(&This->IDirect3DDevice8_iface);
} }
/* IWineD3DDeviceParent methods */ /* IWineD3DDeviceParent methods */
@ -2797,7 +2797,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
"\tmultisample_quality %u, lockable %u, surface %p\n", "\tmultisample_quality %u, lockable %u, surface %p\n",
iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface); iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
hr = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)This, width, height, hr = IDirect3DDevice8_CreateRenderTarget(&This->IDirect3DDevice8_iface, width, height,
d3dformat_from_wined3dformat(format), multisample_type, lockable, (IDirect3DSurface8 **)&d3d_surface); d3dformat_from_wined3dformat(format), multisample_type, lockable, (IDirect3DSurface8 **)&d3d_surface);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -2808,7 +2808,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
*surface = d3d_surface->wineD3DSurface; *surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface); IWineD3DSurface_AddRef(*surface);
d3d_surface->container = (IUnknown *)This; d3d_surface->container = (IUnknown *)&This->IDirect3DDevice8_iface;
/* Implicit surfaces are created with an refcount of 0 */ /* Implicit surfaces are created with an refcount of 0 */
IUnknown_Release((IUnknown *)d3d_surface); IUnknown_Release((IUnknown *)d3d_surface);
@ -2827,7 +2827,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
"\tmultisample_quality %u, discard %u, surface %p\n", "\tmultisample_quality %u, discard %u, surface %p\n",
iface, width, height, format, multisample_type, multisample_quality, discard, surface); iface, width, height, format, multisample_type, multisample_quality, discard, surface);
hr = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)This, width, height, hr = IDirect3DDevice8_CreateDepthStencilSurface(&This->IDirect3DDevice8_iface, width, height,
d3dformat_from_wined3dformat(format), multisample_type, (IDirect3DSurface8 **)&d3d_surface); d3dformat_from_wined3dformat(format), multisample_type, (IDirect3DSurface8 **)&d3d_surface);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -2838,7 +2838,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
*surface = d3d_surface->wineD3DSurface; *surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface); IWineD3DSurface_AddRef(*surface);
d3d_surface->container = (IUnknown *)This; d3d_surface->container = (IUnknown *)&This->IDirect3DDevice8_iface;
/* Implicit surfaces are created with an refcount of 0 */ /* Implicit surfaces are created with an refcount of 0 */
IUnknown_Release((IUnknown *)d3d_surface); IUnknown_Release((IUnknown *)d3d_surface);
@ -2910,7 +2910,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz; local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
local_parameters.FullScreen_PresentationInterval = present_parameters->PresentationInterval; local_parameters.FullScreen_PresentationInterval = present_parameters->PresentationInterval;
hr = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)This, hr = IDirect3DDevice8_CreateAdditionalSwapChain(&This->IDirect3DDevice8_iface,
&local_parameters, (IDirect3DSwapChain8 **)&d3d_swapchain); &local_parameters, (IDirect3DSwapChain8 **)&d3d_swapchain);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -2974,7 +2974,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte
WINED3DPRESENT_PARAMETERS wined3d_parameters; WINED3DPRESENT_PARAMETERS wined3d_parameters;
HRESULT hr; HRESULT hr;
device->lpVtbl = &Direct3DDevice8_Vtbl; device->IDirect3DDevice8_iface.lpVtbl = &Direct3DDevice8_Vtbl;
device->device_parent_vtbl = &d3d8_wined3d_device_parent_vtbl; device->device_parent_vtbl = &d3d8_wined3d_device_parent_vtbl;
device->ref = 1; device->ref = 1;
device->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, device->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,

View File

@ -377,7 +377,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapte
} }
TRACE("Created device %p.\n", object); TRACE("Created device %p.\n", object);
*device = (IDirect3DDevice8 *)object; *device = &object->IDirect3DDevice8_iface;
return D3D_OK; return D3D_OK;
} }

View File

@ -311,7 +311,7 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic
return hr; return hr;
} }
surface->parentDevice = (IDirect3DDevice8 *)device; surface->parentDevice = &device->IDirect3DDevice8_iface;
IUnknown_AddRef(surface->parentDevice); IUnknown_AddRef(surface->parentDevice);
return D3D_OK; return D3D_OK;

View File

@ -166,7 +166,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl
return hr; return hr;
} }
swapchain->parentDevice = (IDirect3DDevice8 *)device; swapchain->parentDevice = &device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(swapchain->parentDevice); IDirect3DDevice8_AddRef(swapchain->parentDevice);
return D3D_OK; return D3D_OK;

View File

@ -369,7 +369,7 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic
return hr; return hr;
} }
texture->parentDevice = (IDirect3DDevice8 *)device; texture->parentDevice = &device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(texture->parentDevice); IDirect3DDevice8_AddRef(texture->parentDevice);
return D3D_OK; return D3D_OK;

View File

@ -370,7 +370,7 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice
return hr; return hr;
} }
texture->parentDevice = (IDirect3DDevice8 *)device; texture->parentDevice = &device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(texture->parentDevice); IDirect3DDevice8_AddRef(texture->parentDevice);
return D3D_OK; return D3D_OK;