d2d1: Implement d2d_effect_GetInputCount().
Signed-off-by: Ziqing Hui <zhui@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
acf56f57e8
commit
d6fe15b8f5
|
@ -572,9 +572,12 @@ struct d2d_effect
|
|||
LONG refcount;
|
||||
|
||||
ID2D1Factory *factory;
|
||||
ID2D1Image **inputs;
|
||||
size_t inputs_size;
|
||||
size_t input_count;
|
||||
};
|
||||
|
||||
void d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory) DECLSPEC_HIDDEN;
|
||||
HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
|
||||
{
|
||||
|
|
|
@ -1887,13 +1887,19 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateEffect(ID2D1DeviceCont
|
|||
{
|
||||
struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
|
||||
struct d2d_effect *object;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("iface %p, effect_id %s, effect %p stub!\n", iface, debugstr_guid(effect_id), effect);
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
d2d_effect_init(object, context->factory);
|
||||
if (FAILED(hr = d2d_effect_init(object, context->factory)))
|
||||
{
|
||||
WARN("Failed to initialize effect, hr %#x.\n", hr);
|
||||
heap_free(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
TRACE("Created effect %p.\n", object);
|
||||
*effect = &object->ID2D1Effect_iface;
|
||||
|
|
|
@ -25,6 +25,12 @@ static inline struct d2d_effect *impl_from_ID2D1Effect(ID2D1Effect *iface)
|
|||
return CONTAINING_RECORD(iface, struct d2d_effect, ID2D1Effect_iface);
|
||||
}
|
||||
|
||||
static void d2d_effect_cleanup(struct d2d_effect *effect)
|
||||
{
|
||||
heap_free(effect->inputs);
|
||||
ID2D1Factory_Release(effect->factory);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_effect_QueryInterface(ID2D1Effect *iface, REFIID iid, void **out)
|
||||
{
|
||||
struct d2d_effect *effect = impl_from_ID2D1Effect(iface);
|
||||
|
@ -72,7 +78,7 @@ static ULONG STDMETHODCALLTYPE d2d_effect_Release(ID2D1Effect *iface)
|
|||
|
||||
if (!refcount)
|
||||
{
|
||||
ID2D1Factory_Release(effect->factory);
|
||||
d2d_effect_cleanup(effect);
|
||||
heap_free(effect);
|
||||
}
|
||||
|
||||
|
@ -183,9 +189,11 @@ static void STDMETHODCALLTYPE d2d_effect_GetInput(ID2D1Effect *iface, UINT32 ind
|
|||
|
||||
static UINT32 STDMETHODCALLTYPE d2d_effect_GetInputCount(ID2D1Effect *iface)
|
||||
{
|
||||
FIXME("iface %p stub!\n", iface);
|
||||
struct d2d_effect *effect = impl_from_ID2D1Effect(iface);
|
||||
|
||||
return 0;
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return effect->input_count;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d2d_effect_GetOutput(ID2D1Effect *iface, ID2D1Image **output)
|
||||
|
@ -269,10 +277,19 @@ static const ID2D1ImageVtbl d2d_effect_image_vtbl =
|
|||
d2d_effect_image_GetFactory,
|
||||
};
|
||||
|
||||
void d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory)
|
||||
HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory)
|
||||
{
|
||||
effect->ID2D1Effect_iface.lpVtbl = &d2d_effect_vtbl;
|
||||
effect->ID2D1Image_iface.lpVtbl = &d2d_effect_image_vtbl;
|
||||
effect->refcount = 1;
|
||||
|
||||
effect->input_count = 1;
|
||||
if (!d2d_array_reserve((void **)&effect->inputs, &effect->inputs_size,
|
||||
effect->input_count, sizeof(*effect->inputs)))
|
||||
return E_OUTOFMEMORY;
|
||||
memset(effect->inputs, 0, sizeof(*effect->inputs) * effect->input_count);
|
||||
|
||||
ID2D1Factory_AddRef(effect->factory = factory);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -9802,7 +9802,7 @@ static void test_effect(BOOL d3d11)
|
|||
}
|
||||
|
||||
input_count = ID2D1Effect_GetInputCount(effect);
|
||||
todo_wine
|
||||
todo_wine_if(test->default_input_count != 1)
|
||||
ok (input_count == test->default_input_count, "Got unexpected input count %u, expected %u.\n",
|
||||
input_count, test->default_input_count);
|
||||
|
||||
|
|
Loading…
Reference in New Issue