d2d1: Add a properties list for builtin effects.
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
d6fe15b8f5
commit
b2b73446e5
|
@ -577,7 +577,7 @@ struct d2d_effect
|
||||||
size_t input_count;
|
size_t input_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory) DECLSPEC_HIDDEN;
|
HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory, const CLSID *effect_id) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
|
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1894,7 +1894,7 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateEffect(ID2D1DeviceCont
|
||||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
if (FAILED(hr = d2d_effect_init(object, context->factory)))
|
if (FAILED(hr = d2d_effect_init(object, context->factory, effect_id)))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize effect, hr %#x.\n", hr);
|
WARN("Failed to initialize effect, hr %#x.\n", hr);
|
||||||
heap_free(object);
|
heap_free(object);
|
||||||
|
|
|
@ -20,6 +20,19 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
|
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
|
||||||
|
|
||||||
|
struct d2d_effect_info
|
||||||
|
{
|
||||||
|
const CLSID *clsid;
|
||||||
|
UINT32 default_input_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct d2d_effect_info builtin_effects[] =
|
||||||
|
{
|
||||||
|
{&CLSID_D2D12DAffineTransform, 1},
|
||||||
|
{&CLSID_D2D13DPerspectiveTransform, 1},
|
||||||
|
{&CLSID_D2D1Composite, 2}
|
||||||
|
};
|
||||||
|
|
||||||
static inline struct d2d_effect *impl_from_ID2D1Effect(ID2D1Effect *iface)
|
static inline struct d2d_effect *impl_from_ID2D1Effect(ID2D1Effect *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, struct d2d_effect, ID2D1Effect_iface);
|
return CONTAINING_RECORD(iface, struct d2d_effect, ID2D1Effect_iface);
|
||||||
|
@ -277,19 +290,31 @@ static const ID2D1ImageVtbl d2d_effect_image_vtbl =
|
||||||
d2d_effect_image_GetFactory,
|
d2d_effect_image_GetFactory,
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory)
|
HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory, const CLSID *effect_id)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
effect->ID2D1Effect_iface.lpVtbl = &d2d_effect_vtbl;
|
effect->ID2D1Effect_iface.lpVtbl = &d2d_effect_vtbl;
|
||||||
effect->ID2D1Image_iface.lpVtbl = &d2d_effect_image_vtbl;
|
effect->ID2D1Image_iface.lpVtbl = &d2d_effect_image_vtbl;
|
||||||
effect->refcount = 1;
|
effect->refcount = 1;
|
||||||
|
|
||||||
effect->input_count = 1;
|
for (i = 0; i < ARRAY_SIZE(builtin_effects); ++i)
|
||||||
if (!d2d_array_reserve((void **)&effect->inputs, &effect->inputs_size,
|
{
|
||||||
effect->input_count, sizeof(*effect->inputs)))
|
if (IsEqualGUID(effect_id, builtin_effects[i].clsid))
|
||||||
return E_OUTOFMEMORY;
|
{
|
||||||
memset(effect->inputs, 0, sizeof(*effect->inputs) * effect->input_count);
|
effect->input_count = builtin_effects[i].default_input_count;
|
||||||
|
|
||||||
ID2D1Factory_AddRef(effect->factory = factory);
|
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);
|
||||||
|
|
||||||
return S_OK;
|
ID2D1Factory_AddRef(effect->factory = factory);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN("Unsupported effect clsid %s.\n", debugstr_guid(effect_id));
|
||||||
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9802,7 +9802,6 @@ static void test_effect(BOOL d3d11)
|
||||||
}
|
}
|
||||||
|
|
||||||
input_count = ID2D1Effect_GetInputCount(effect);
|
input_count = ID2D1Effect_GetInputCount(effect);
|
||||||
todo_wine_if(test->default_input_count != 1)
|
|
||||||
ok (input_count == test->default_input_count, "Got unexpected input count %u, expected %u.\n",
|
ok (input_count == test->default_input_count, "Got unexpected input count %u, expected %u.\n",
|
||||||
input_count, test->default_input_count);
|
input_count, test->default_input_count);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue