From 54a61ae734627f7e9873d60567decab97a52e60f Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 28 Jan 2011 01:17:54 +0100 Subject: [PATCH] d3d8: Finish the COM cleanup of the IDirect3DDevice8 iface. --- dlls/d3d8/buffer.c | 4 ++-- dlls/d3d8/cubetexture.c | 2 +- dlls/d3d8/d3d8_private.h | 2 +- dlls/d3d8/device.c | 20 ++++++++++---------- dlls/d3d8/directx.c | 2 +- dlls/d3d8/surface.c | 2 +- dlls/d3d8/swapchain.c | 2 +- dlls/d3d8/texture.c | 2 +- dlls/d3d8/volumetexture.c | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index e2a026be3f1..1389885e42d 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -277,7 +277,7 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im return hr; } - buffer->parentDevice = (IDirect3DDevice8 *)device; + buffer->parentDevice = &device->IDirect3DDevice8_iface; IUnknown_AddRef(buffer->parentDevice); return D3D_OK; @@ -538,7 +538,7 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl return hr; } - buffer->parentDevice = (IDirect3DDevice8 *)device; + buffer->parentDevice = &device->IDirect3DDevice8_iface; IUnknown_AddRef(buffer->parentDevice); return D3D_OK; diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c index 7fa48b76406..705a3a5891f 100644 --- a/dlls/d3d8/cubetexture.c +++ b/dlls/d3d8/cubetexture.c @@ -382,7 +382,7 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp return hr; } - texture->parentDevice = (IDirect3DDevice8 *)device; + texture->parentDevice = &device->IDirect3DDevice8_iface; IDirect3DDevice8_AddRef(texture->parentDevice); return D3D_OK; diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 3352e2b9c11..3bfceb29763 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -177,7 +177,7 @@ struct FvfToDecl struct IDirect3DDevice8Impl { /* IUnknown fields */ - const IDirect3DDevice8Vtbl *lpVtbl; + IDirect3DDevice8 IDirect3DDevice8_iface; const IWineD3DDeviceParentVtbl *device_parent_vtbl; LONG ref; /* But what about baseVertexIndex in state blocks? hmm... it may be a better idea to pass this to wined3d */ diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 667d8a29d16..5582b336da7 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -266,7 +266,7 @@ static ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *swapchain) 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, @@ -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) { 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) { 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) { struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); - return IDirect3DDevice8Impl_Release((IDirect3DDevice8 *)This); + return IDirect3DDevice8Impl_Release(&This->IDirect3DDevice8_iface); } /* IWineD3DDeviceParent methods */ @@ -2797,7 +2797,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice "\tmultisample_quality %u, lockable %u, surface %p\n", 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); if (FAILED(hr)) { @@ -2808,7 +2808,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice *surface = d3d_surface->wineD3DSurface; IWineD3DSurface_AddRef(*surface); - d3d_surface->container = (IUnknown *)This; + d3d_surface->container = (IUnknown *)&This->IDirect3DDevice8_iface; /* Implicit surfaces are created with an refcount of 0 */ IUnknown_Release((IUnknown *)d3d_surface); @@ -2827,7 +2827,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3 "\tmultisample_quality %u, discard %u, surface %p\n", 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); if (FAILED(hr)) { @@ -2838,7 +2838,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3 *surface = d3d_surface->wineD3DSurface; IWineD3DSurface_AddRef(*surface); - d3d_surface->container = (IUnknown *)This; + d3d_surface->container = (IUnknown *)&This->IDirect3DDevice8_iface; /* Implicit surfaces are created with an refcount of 0 */ 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_PresentationInterval = present_parameters->PresentationInterval; - hr = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)This, + hr = IDirect3DDevice8_CreateAdditionalSwapChain(&This->IDirect3DDevice8_iface, &local_parameters, (IDirect3DSwapChain8 **)&d3d_swapchain); if (FAILED(hr)) { @@ -2974,7 +2974,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte WINED3DPRESENT_PARAMETERS wined3d_parameters; HRESULT hr; - device->lpVtbl = &Direct3DDevice8_Vtbl; + device->IDirect3DDevice8_iface.lpVtbl = &Direct3DDevice8_Vtbl; device->device_parent_vtbl = &d3d8_wined3d_device_parent_vtbl; device->ref = 1; device->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index d01f4134042..f2e6323ebd5 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -377,7 +377,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapte } TRACE("Created device %p.\n", object); - *device = (IDirect3DDevice8 *)object; + *device = &object->IDirect3DDevice8_iface; return D3D_OK; } diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index d6bfd63c7ea..93b9fbe55ad 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -311,7 +311,7 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic return hr; } - surface->parentDevice = (IDirect3DDevice8 *)device; + surface->parentDevice = &device->IDirect3DDevice8_iface; IUnknown_AddRef(surface->parentDevice); return D3D_OK; diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c index 1c2a5357824..4875d3a5abb 100644 --- a/dlls/d3d8/swapchain.c +++ b/dlls/d3d8/swapchain.c @@ -166,7 +166,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl return hr; } - swapchain->parentDevice = (IDirect3DDevice8 *)device; + swapchain->parentDevice = &device->IDirect3DDevice8_iface; IDirect3DDevice8_AddRef(swapchain->parentDevice); return D3D_OK; diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index b4f3258373c..b43239027a6 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -369,7 +369,7 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic return hr; } - texture->parentDevice = (IDirect3DDevice8 *)device; + texture->parentDevice = &device->IDirect3DDevice8_iface; IDirect3DDevice8_AddRef(texture->parentDevice); return D3D_OK; diff --git a/dlls/d3d8/volumetexture.c b/dlls/d3d8/volumetexture.c index 9b78d6ed159..b4396a3b07a 100644 --- a/dlls/d3d8/volumetexture.c +++ b/dlls/d3d8/volumetexture.c @@ -370,7 +370,7 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice return hr; } - texture->parentDevice = (IDirect3DDevice8 *)device; + texture->parentDevice = &device->IDirect3DDevice8_iface; IDirect3DDevice8_AddRef(texture->parentDevice); return D3D_OK;