d3d8: COM cleanup for the IDirect3DSurface8 iface.

This commit is contained in:
Michael Stefaniuc 2011-07-05 00:41:12 +02:00 committed by Alexandre Julliard
parent cce8294f39
commit d615be8eea
3 changed files with 33 additions and 24 deletions

View File

@ -240,8 +240,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl
*/ */
struct IDirect3DSurface8Impl struct IDirect3DSurface8Impl
{ {
/* IUnknown fields */ IDirect3DSurface8 IDirect3DSurface8_iface;
const IDirect3DSurface8Vtbl *lpVtbl;
LONG ref; LONG ref;
struct wined3d_surface *wined3d_surface; struct wined3d_surface *wined3d_surface;
IDirect3DDevice8 *parentDevice; IDirect3DDevice8 *parentDevice;

View File

@ -905,7 +905,7 @@ static HRESULT IDirect3DDevice8Impl_CreateSurface(IDirect3DDevice8Impl *device,
} }
TRACE("Created surface %p.\n", object); TRACE("Created surface %p.\n", object);
*ppSurface = (IDirect3DSurface8 *)object; *ppSurface = &object->IDirect3DSurface8_iface;
return D3D_OK; return D3D_OK;
} }
@ -2874,7 +2874,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
IUnknown_Release(d3d_surface->parentDevice); IUnknown_Release(d3d_surface->parentDevice);
d3d_surface->parentDevice = NULL; d3d_surface->parentDevice = NULL;
IDirect3DSurface8_Release((IDirect3DSurface8 *)d3d_surface); IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface);
d3d_surface->forwardReference = container_parent; d3d_surface->forwardReference = container_parent;
return hr; return hr;
@ -2907,7 +2907,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface; d3d_surface->container = (IUnknown *)&device->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); IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface);
return hr; return hr;
} }
@ -2937,7 +2937,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa
d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface; d3d_surface->container = (IUnknown *)&device->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); IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface);
return hr; return hr;
} }

View File

@ -26,12 +26,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
static inline IDirect3DSurface8Impl *impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) static inline IDirect3DSurface8Impl *impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
{ {
return CONTAINING_RECORD(iface, IDirect3DSurface8Impl, lpVtbl); return CONTAINING_RECORD(iface, IDirect3DSurface8Impl, IDirect3DSurface8_iface);
} }
/* IDirect3DSurface8 IUnknown parts follow: */ /* IDirect3DSurface8 IUnknown parts follow: */
static HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(LPDIRECT3DSURFACE8 iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(IDirect3DSurface8 *iface, REFIID riid,
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; void **ppobj)
{
IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj);
@ -48,8 +50,9 @@ static HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(LPDIRECT3DSURFACE8 if
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI IDirect3DSurface8Impl_AddRef(LPDIRECT3DSURFACE8 iface) { static ULONG WINAPI IDirect3DSurface8Impl_AddRef(IDirect3DSurface8 *iface)
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; {
IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
@ -75,8 +78,9 @@ static ULONG WINAPI IDirect3DSurface8Impl_AddRef(LPDIRECT3DSURFACE8 iface) {
} }
} }
static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) { static ULONG WINAPI IDirect3DSurface8Impl_Release(IDirect3DSurface8 *iface)
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; {
IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
@ -106,9 +110,10 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) {
} }
/* IDirect3DSurface8 IDirect3DResource8 Interface follow: */ /* IDirect3DSurface8 IDirect3DResource8 Interface follow: */
static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface, IDirect3DDevice8 **device) static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface,
IDirect3DDevice8 **device)
{ {
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
TRACE("iface %p, device %p.\n", iface, device); TRACE("iface %p, device %p.\n", iface, device);
@ -190,8 +195,10 @@ static HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(IDirect3DSurface8 *i
} }
/* IDirect3DSurface8 Interface follow: */ /* IDirect3DSurface8 Interface follow: */
static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 iface, REFIID riid, void **ppContainer) { static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(IDirect3DSurface8 *iface, REFIID riid,
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; void **ppContainer)
{
IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
HRESULT res; HRESULT res;
TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), ppContainer); TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), ppContainer);
@ -206,7 +213,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 ifac
static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc) static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc)
{ {
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
struct wined3d_resource_desc wined3d_desc; struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource; struct wined3d_resource *wined3d_resource;
@ -229,8 +236,10 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(IDirect3DSurface8 *iface,
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags)
{
IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, locked_rect %p, rect %p, flags %#x.\n", iface, pLockedRect, pRect, Flags); TRACE("iface %p, locked_rect %p, rect %p, flags %#x.\n", iface, pLockedRect, pRect, Flags);
@ -259,8 +268,9 @@ static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface) { static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(IDirect3DSurface8 *iface)
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; {
IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
@ -310,7 +320,7 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic
{ {
HRESULT hr; HRESULT hr;
surface->lpVtbl = &Direct3DSurface8_Vtbl; surface->IDirect3DSurface8_iface.lpVtbl = &Direct3DSurface8_Vtbl;
surface->ref = 1; surface->ref = 1;
/* FIXME: Check MAX bounds of MultisampleQuality. */ /* FIXME: Check MAX bounds of MultisampleQuality. */