wined3d: Add a separate function for rendertarget view initialization.

This commit is contained in:
Henri Verbeet 2010-04-13 20:46:24 +02:00 committed by Alexandre Julliard
parent 242370b836
commit d1d8c81439
3 changed files with 18 additions and 7 deletions

View file

@ -838,6 +838,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateRendertargetView(IWineD3DDevice *
{
struct wined3d_rendertarget_view *object;
TRACE("iface %p, resource %p, parent %p, rendertarget_view %p.\n",
iface, resource, parent, rendertarget_view);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
@ -845,12 +848,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateRendertargetView(IWineD3DDevice *
return E_OUTOFMEMORY;
}
object->vtbl = &wined3d_rendertarget_view_vtbl;
object->refcount = 1;
IWineD3DResource_AddRef(resource);
object->resource = resource;
object->parent = parent;
wined3d_rendertarget_view_init(object, resource, parent);
TRACE("Created render target view %p.\n", object);
*rendertarget_view = (IWineD3DRendertargetView *)object;
return WINED3D_OK;

View file

@ -97,7 +97,7 @@ static HRESULT STDMETHODCALLTYPE rendertarget_view_GetResource(IWineD3DRendertar
return WINED3D_OK;
}
const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl =
static const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl =
{
/* IUnknown methods */
rendertarget_view_QueryInterface,
@ -108,3 +108,13 @@ const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl =
/* IWineD3DRendertargetView methods */
rendertarget_view_GetResource,
};
void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
IWineD3DResource *resource, IUnknown *parent)
{
view->vtbl = &wined3d_rendertarget_view_vtbl;
view->refcount = 1;
IWineD3DResource_AddRef(resource);
view->resource = resource;
view->parent = parent;
}

View file

@ -2549,7 +2549,8 @@ struct wined3d_rendertarget_view
IUnknown *parent;
};
extern const IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl DECLSPEC_HIDDEN;
void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
IWineD3DResource *resource, IUnknown *parent) DECLSPEC_HIDDEN;
/*****************************************************************************
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)