d2d1: Move mesh creation to mesh.c.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-31 14:49:32 +03:00 committed by Alexandre Julliard
parent 27d5d4caf2
commit 3d222560b2
3 changed files with 15 additions and 13 deletions

View File

@ -188,7 +188,7 @@ struct d2d_mesh
ID2D1Factory *factory;
};
void d2d_mesh_init(struct d2d_mesh *mesh, ID2D1Factory *factory) DECLSPEC_HIDDEN;
HRESULT d2d_mesh_create(ID2D1Factory *factory, struct d2d_mesh **mesh) DECLSPEC_HIDDEN;
struct d2d_bitmap
{

View File

@ -98,9 +98,15 @@ static const struct ID2D1MeshVtbl d2d_mesh_vtbl =
d2d_mesh_Open,
};
void d2d_mesh_init(struct d2d_mesh *mesh, ID2D1Factory *factory)
HRESULT d2d_mesh_create(ID2D1Factory *factory, struct d2d_mesh **mesh)
{
mesh->ID2D1Mesh_iface.lpVtbl = &d2d_mesh_vtbl;
mesh->refcount = 1;
ID2D1Factory_AddRef(mesh->factory = factory);
if (!(*mesh = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**mesh))))
return E_OUTOFMEMORY;
(*mesh)->ID2D1Mesh_iface.lpVtbl = &d2d_mesh_vtbl;
(*mesh)->refcount = 1;
ID2D1Factory_AddRef((*mesh)->factory = factory);
TRACE("Created mesh %p.\n", *mesh);
return S_OK;
}

View File

@ -446,18 +446,14 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateMesh(ID2D1RenderTar
{
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
struct d2d_mesh *object;
HRESULT hr;
TRACE("iface %p, mesh %p.\n", iface, mesh);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (SUCCEEDED(hr = d2d_mesh_create(render_target->factory, &object)))
*mesh = &object->ID2D1Mesh_iface;
d2d_mesh_init(object, render_target->factory);
TRACE("Created mesh %p.\n", object);
*mesh = &object->ID2D1Mesh_iface;
return S_OK;
return hr;
}
static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawLine(ID2D1RenderTarget *iface,