ddraw: Add a separate function for parent initialization.

This commit is contained in:
Henri Verbeet 2010-08-18 19:26:24 +02:00 committed by Alexandre Julliard
parent 921bd1bf9a
commit 759fd517aa
3 changed files with 11 additions and 6 deletions

View File

@ -4701,8 +4701,8 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid,
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
index_buffer_parent->lpVtbl = &IParent_Vtbl;
index_buffer_parent->ref = 1; ddraw_parent_init(index_buffer_parent);
/* Create an Index Buffer. WineD3D needs one for Drawing indexed primitives /* Create an Index Buffer. WineD3D needs one for Drawing indexed primitives
* Create a (hopefully) long enough buffer, and copy the indices into it * Create a (hopefully) long enough buffer, and copy the indices into it
@ -5928,8 +5928,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return DDERR_OUTOFVIDEOMEMORY; return DDERR_OUTOFVIDEOMEMORY;
} }
object->lpVtbl = &IParent_Vtbl; ddraw_parent_init(object);
object->ref = 1;
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters, hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
swapchain, (IUnknown *)object, This->ImplType); swapchain, (IUnknown *)object, This->ImplType);

View File

@ -315,7 +315,7 @@ struct IParentImpl
}; };
extern const IParentVtbl IParent_Vtbl DECLSPEC_HIDDEN; void ddraw_parent_init(IParentImpl *parent) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IDirect3DDevice implementation * IDirect3DDevice implementation

View File

@ -121,9 +121,15 @@ static ULONG WINAPI IParentImpl_Release(IParent *iface)
/***************************************************************************** /*****************************************************************************
* The VTable * The VTable
*****************************************************************************/ *****************************************************************************/
const IParentVtbl IParent_Vtbl = static const struct IParentVtbl ddraw_parent_vtbl =
{ {
IParentImpl_QueryInterface, IParentImpl_QueryInterface,
IParentImpl_AddRef, IParentImpl_AddRef,
IParentImpl_Release, IParentImpl_Release,
}; };
void ddraw_parent_init(IParentImpl *parent)
{
parent->lpVtbl = &ddraw_parent_vtbl;
parent->ref = 1;
}