Commit d1d8c814 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Add a separate function for rendertarget view initialization.

parent 242370b8
......@@ -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;
......
......@@ -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;
}
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment