Commit 3d222560 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d2d1: Move mesh creation to mesh.c.

parent 27d5d4ca
......@@ -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
{
......
......@@ -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;
}
......@@ -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;
d2d_mesh_init(object, render_target->factory);
TRACE("Created mesh %p.\n", object);
*mesh = &object->ID2D1Mesh_iface;
if (SUCCEEDED(hr = d2d_mesh_create(render_target->factory, &object)))
*mesh = &object->ID2D1Mesh_iface;
return S_OK;
return hr;
}
static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawLine(ID2D1RenderTarget *iface,
......
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