Ziqing Hui : d2d1: Implement d2d_effect_GetInputCount().
Alexandre Julliard
julliard at winehq.org
Mon Aug 9 16:21:43 CDT 2021
Module: wine
Branch: master
Commit: d6fe15b8f5110dcf29d561b457a5e805c25093d8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d6fe15b8f5110dcf29d561b457a5e805c25093d8
Author: Ziqing Hui <zhui at codeweavers.com>
Date: Sun Aug 8 12:40:32 2021 +0800
d2d1: Implement d2d_effect_GetInputCount().
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d2d1/d2d1_private.h | 5 ++++-
dlls/d2d1/device.c | 8 +++++++-
dlls/d2d1/effect.c | 25 +++++++++++++++++++++----
dlls/d2d1/tests/d2d1.c | 2 +-
4 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index ce99e7c3432..48d15dfcf22 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -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)
{
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 0647bc57fc3..d8704f1b43b 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -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;
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index 40dd2187953..acf83ab1b02 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -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;
}
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 146952d7418..64d9765e866 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -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);
More information about the wine-cvs
mailing list