ddraw: COM cleanup for the IDirect3DExecuteBuffer iface.

This commit is contained in:
Michael Stefaniuc 2011-07-08 12:26:57 +02:00 committed by Alexandre Julliard
parent 9ab233ea24
commit 663483e16e
3 changed files with 22 additions and 24 deletions

View File

@ -486,10 +486,8 @@ void d3d_viewport_init(IDirect3DViewportImpl *viewport, IDirectDrawImpl *ddraw)
*****************************************************************************/
struct IDirect3DExecuteBufferImpl
{
/* IUnknown */
const IDirect3DExecuteBufferVtbl *lpVtbl;
LONG ref;
IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface;
LONG ref;
/* IDirect3DExecuteBuffer fields */
IDirectDrawImpl *ddraw;
IDirect3DDeviceImpl *d3ddev;

View File

@ -685,7 +685,7 @@ IDirect3DDeviceImpl_1_CreateExecuteBuffer(IDirect3DDevice *iface,
return hr;
}
*ExecuteBuffer = (IDirect3DExecuteBuffer *)object;
*ExecuteBuffer = &object->IDirect3DExecuteBuffer_iface;
TRACE(" Returning IDirect3DExecuteBuffer at %p, implementation is at %p\n", *ExecuteBuffer, object);

View File

@ -547,6 +547,11 @@ end_of_buffer:
return D3D_OK;
}
static inline IDirect3DExecuteBufferImpl *impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface)
{
return CONTAINING_RECORD(iface, IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer_iface);
}
/*****************************************************************************
* IDirect3DExecuteBuffer::QueryInterface
*
@ -598,10 +603,9 @@ IDirect3DExecuteBufferImpl_QueryInterface(IDirect3DExecuteBuffer *iface,
* The new refcount
*
*****************************************************************************/
static ULONG WINAPI
IDirect3DExecuteBufferImpl_AddRef(IDirect3DExecuteBuffer *iface)
static ULONG WINAPI IDirect3DExecuteBufferImpl_AddRef(IDirect3DExecuteBuffer *iface)
{
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u.\n", This, ref);
@ -618,10 +622,9 @@ IDirect3DExecuteBufferImpl_AddRef(IDirect3DExecuteBuffer *iface)
* The new refcount
*
*****************************************************************************/
static ULONG WINAPI
IDirect3DExecuteBufferImpl_Release(IDirect3DExecuteBuffer *iface)
static ULONG WINAPI IDirect3DExecuteBufferImpl_Release(IDirect3DExecuteBuffer *iface)
{
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p decreasing refcount to %u.\n", This, ref);
@ -669,11 +672,10 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Initialize(IDirect3DExecuteBuff
* This implementation always returns D3D_OK
*
*****************************************************************************/
static HRESULT WINAPI
IDirect3DExecuteBufferImpl_Lock(IDirect3DExecuteBuffer *iface,
D3DEXECUTEBUFFERDESC *lpDesc)
static HRESULT WINAPI IDirect3DExecuteBufferImpl_Lock(IDirect3DExecuteBuffer *iface,
D3DEXECUTEBUFFERDESC *lpDesc)
{
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface);
DWORD dwSize;
TRACE("iface %p, desc %p.\n", iface, lpDesc);
@ -719,11 +721,10 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Unlock(IDirect3DExecuteBuffer *
* DDERR_OUTOFMEMORY if the vertex buffer allocation failed
*
*****************************************************************************/
static HRESULT WINAPI
IDirect3DExecuteBufferImpl_SetExecuteData(IDirect3DExecuteBuffer *iface,
D3DEXECUTEDATA *lpData)
static HRESULT WINAPI IDirect3DExecuteBufferImpl_SetExecuteData(IDirect3DExecuteBuffer *iface,
D3DEXECUTEDATA *lpData)
{
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface);
DWORD nbvert;
TRACE("iface %p, data %p.\n", iface, lpData);
@ -755,11 +756,10 @@ IDirect3DExecuteBufferImpl_SetExecuteData(IDirect3DExecuteBuffer *iface,
* D3D_OK on success
*
*****************************************************************************/
static HRESULT WINAPI
IDirect3DExecuteBufferImpl_GetExecuteData(IDirect3DExecuteBuffer *iface,
D3DEXECUTEDATA *lpData)
static HRESULT WINAPI IDirect3DExecuteBufferImpl_GetExecuteData(IDirect3DExecuteBuffer *iface,
D3DEXECUTEDATA *lpData)
{
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface);
DWORD dwSize;
TRACE("iface %p, data %p.\n", iface, lpData);
@ -839,7 +839,7 @@ static const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl =
HRESULT d3d_execute_buffer_init(IDirect3DExecuteBufferImpl *execute_buffer,
IDirect3DDeviceImpl *device, D3DEXECUTEBUFFERDESC *desc)
{
execute_buffer->lpVtbl = &d3d_execute_buffer_vtbl;
execute_buffer->IDirect3DExecuteBuffer_iface.lpVtbl = &d3d_execute_buffer_vtbl;
execute_buffer->ref = 1;
execute_buffer->d3ddev = device;