ddraw: Add a separate function for viewport initialization.

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

View File

@ -4505,10 +4505,7 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
object->lpVtbl = &IDirect3DViewport3_Vtbl; d3d_viewport_init(object, ddraw_from_d3d3(iface));
object->ref = 1;
object->ddraw = ddraw_from_d3d3(iface);
object->use_vp2 = 0xff;
TRACE("Created viewport %p.\n", object); TRACE("Created viewport %p.\n", object);
*viewport = (IDirect3DViewport3 *)object; *viewport = (IDirect3DViewport3 *)object;

View File

@ -587,11 +587,9 @@ struct IDirect3DViewportImpl
IDirect3DMaterialImpl *background; IDirect3DMaterialImpl *background;
}; };
/* Vtable */
extern const IDirect3DViewport3Vtbl IDirect3DViewport3_Vtbl DECLSPEC_HIDDEN;
/* Helper functions */ /* Helper functions */
void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) DECLSPEC_HIDDEN; void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) DECLSPEC_HIDDEN;
void d3d_viewport_init(IDirect3DViewportImpl *viewport, IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IDirect3DExecuteBuffer - Wraps to D3D7 * IDirect3DExecuteBuffer - Wraps to D3D7

View File

@ -1078,7 +1078,7 @@ IDirect3DViewportImpl_Clear2(IDirect3DViewport3 *iface,
* The VTable * The VTable
*****************************************************************************/ *****************************************************************************/
const IDirect3DViewport3Vtbl IDirect3DViewport3_Vtbl = static const struct IDirect3DViewport3Vtbl d3d_viewport_vtbl =
{ {
/*** IUnknown Methods ***/ /*** IUnknown Methods ***/
IDirect3DViewportImpl_QueryInterface, IDirect3DViewportImpl_QueryInterface,
@ -1106,3 +1106,11 @@ const IDirect3DViewport3Vtbl IDirect3DViewport3_Vtbl =
IDirect3DViewportImpl_GetBackgroundDepth2, IDirect3DViewportImpl_GetBackgroundDepth2,
IDirect3DViewportImpl_Clear2, IDirect3DViewportImpl_Clear2,
}; };
void d3d_viewport_init(IDirect3DViewportImpl *viewport, IDirectDrawImpl *ddraw)
{
viewport->lpVtbl = &d3d_viewport_vtbl;
viewport->ref = 1;
viewport->ddraw = ddraw;
viewport->use_vp2 = 0xff;
}