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

d2d1: Implement d2d_state_block_GetFactory().

parent 7f416ff3
......@@ -200,12 +200,13 @@ struct d2d_state_block
ID2D1DrawingStateBlock ID2D1DrawingStateBlock_iface;
LONG refcount;
ID2D1Factory *factory;
D2D1_DRAWING_STATE_DESCRIPTION drawing_state;
IDWriteRenderingParams *text_rendering_params;
};
void d2d_state_block_init(struct d2d_state_block *state_block, const D2D1_DRAWING_STATE_DESCRIPTION *desc,
IDWriteRenderingParams *text_rendering_params) DECLSPEC_HIDDEN;
void d2d_state_block_init(struct d2d_state_block *state_block, ID2D1Factory *factory,
const D2D1_DRAWING_STATE_DESCRIPTION *desc, IDWriteRenderingParams *text_rendering_params) DECLSPEC_HIDDEN;
struct d2d_state_block *unsafe_impl_from_ID2D1DrawingStateBlock(ID2D1DrawingStateBlock *iface) DECLSPEC_HIDDEN;
enum d2d_geometry_state
......
......@@ -199,7 +199,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDrawingStateBlock(ID2D1Factor
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
d2d_state_block_init(object, desc, text_rendering_params);
d2d_state_block_init(object, iface, desc, text_rendering_params);
TRACE("Created state block %p.\n", object);
*state_block = &object->ID2D1DrawingStateBlock_iface;
......
......@@ -68,6 +68,7 @@ static ULONG STDMETHODCALLTYPE d2d_state_block_Release(ID2D1DrawingStateBlock *i
{
if (state_block->text_rendering_params)
IDWriteRenderingParams_Release(state_block->text_rendering_params);
ID2D1Factory_Release(state_block->factory);
HeapFree(GetProcessHeap(), 0, state_block);
}
......@@ -76,9 +77,11 @@ static ULONG STDMETHODCALLTYPE d2d_state_block_Release(ID2D1DrawingStateBlock *i
static void STDMETHODCALLTYPE d2d_state_block_GetFactory(ID2D1DrawingStateBlock *iface, ID2D1Factory **factory)
{
FIXME("iface %p, factory %p stub!\n", iface, factory);
struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock(iface);
TRACE("iface %p, factory %p.\n", iface, factory);
*factory = NULL;
ID2D1Factory_AddRef(*factory = state_block->factory);
}
static void STDMETHODCALLTYPE d2d_state_block_GetDescription(ID2D1DrawingStateBlock *iface,
......@@ -138,8 +141,8 @@ static const struct ID2D1DrawingStateBlockVtbl d2d_state_block_vtbl =
d2d_state_block_GetTextRenderingParams,
};
void d2d_state_block_init(struct d2d_state_block *state_block, const D2D1_DRAWING_STATE_DESCRIPTION *desc,
IDWriteRenderingParams *text_rendering_params)
void d2d_state_block_init(struct d2d_state_block *state_block, ID2D1Factory *factory,
const D2D1_DRAWING_STATE_DESCRIPTION *desc, IDWriteRenderingParams *text_rendering_params)
{
static const D2D1_MATRIX_3X2_F identity =
{
......@@ -150,6 +153,7 @@ void d2d_state_block_init(struct d2d_state_block *state_block, const D2D1_DRAWIN
state_block->ID2D1DrawingStateBlock_iface.lpVtbl = &d2d_state_block_vtbl;
state_block->refcount = 1;
ID2D1Factory_AddRef(state_block->factory = factory);
if (desc)
state_block->drawing_state = *desc;
else
......
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