Commit 9745efaf authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d2d1: Implement d2d_mesh_GetFactory().

parent c1fc0084
......@@ -175,9 +175,11 @@ struct d2d_mesh
{
ID2D1Mesh ID2D1Mesh_iface;
LONG refcount;
ID2D1Factory *factory;
};
void d2d_mesh_init(struct d2d_mesh *mesh) DECLSPEC_HIDDEN;
void d2d_mesh_init(struct d2d_mesh *mesh, ID2D1Factory *factory) DECLSPEC_HIDDEN;
struct d2d_bitmap
{
......
......@@ -65,16 +65,21 @@ static ULONG STDMETHODCALLTYPE d2d_mesh_Release(ID2D1Mesh *iface)
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
{
ID2D1Factory_Release(mesh->factory);
HeapFree(GetProcessHeap(), 0, mesh);
}
return refcount;
}
static void STDMETHODCALLTYPE d2d_mesh_GetFactory(ID2D1Mesh *iface, ID2D1Factory **factory)
{
FIXME("iface %p, factory %p stub!\n", iface, factory);
struct d2d_mesh *mesh = impl_from_ID2D1Mesh(iface);
TRACE("iface %p, factory %p.\n", iface, factory);
*factory = NULL;
ID2D1Factory_AddRef(*factory = mesh->factory);
}
static HRESULT STDMETHODCALLTYPE d2d_mesh_Open(ID2D1Mesh *iface, ID2D1TessellationSink **sink)
......@@ -93,8 +98,9 @@ static const struct ID2D1MeshVtbl d2d_mesh_vtbl =
d2d_mesh_Open,
};
void d2d_mesh_init(struct d2d_mesh *mesh)
void d2d_mesh_init(struct d2d_mesh *mesh, ID2D1Factory *factory)
{
mesh->ID2D1Mesh_iface.lpVtbl = &d2d_mesh_vtbl;
mesh->refcount = 1;
ID2D1Factory_AddRef(mesh->factory = factory);
}
......@@ -533,6 +533,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateLayer(ID2D1RenderTa
static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateMesh(ID2D1RenderTarget *iface, ID2D1Mesh **mesh)
{
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
struct d2d_mesh *object;
TRACE("iface %p, mesh %p.\n", iface, mesh);
......@@ -540,7 +541,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateMesh(ID2D1RenderTar
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
d2d_mesh_init(object);
d2d_mesh_init(object, render_target->factory);
TRACE("Created mesh %p.\n", object);
*mesh = &object->ID2D1Mesh_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