Signed-off-by: Ziqing Hui zhui@codeweavers.com ---
This supersedes 211082. Changes: Add a info field to d2d_effect.
dlls/d2d1/d2d1_private.h | 10 ++++++++ dlls/d2d1/effect.c | 55 ++++++++++++++++++++++++++-------------- dlls/d2d1/tests/d2d1.c | 2 -- 3 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 88c712cf51c..e823b2092bf 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -565,12 +565,22 @@ struct d2d_device
void d2d_device_init(struct d2d_device *device, ID2D1Factory1 *factory, IDXGIDevice *dxgi_device) DECLSPEC_HIDDEN;
+struct d2d_effect_info +{ + const CLSID *clsid; + UINT32 default_input_count; + UINT32 min_inputs; + UINT32 max_inputs; +}; + struct d2d_effect { ID2D1Effect ID2D1Effect_iface; ID2D1Image ID2D1Image_iface; LONG refcount;
+ const struct d2d_effect_info *info; + ID2D1Factory *factory; ID2D1Image **inputs; size_t inputs_size; diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index 560d87479a9..ef1189ba042 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -20,17 +20,11 @@
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} + {&CLSID_D2D12DAffineTransform, 1, 1, 1}, + {&CLSID_D2D13DPerspectiveTransform, 1, 1, 1}, + {&CLSID_D2D1Composite, 2, 1, 0xffffffff} };
static inline struct d2d_effect *impl_from_ID2D1Effect(ID2D1Effect *iface) @@ -207,9 +201,38 @@ static void STDMETHODCALLTYPE d2d_effect_SetInput(ID2D1Effect *iface, UINT32 ind
static HRESULT STDMETHODCALLTYPE d2d_effect_SetInputCount(ID2D1Effect *iface, UINT32 count) { - FIXME("iface %p, count %u stub!\n", iface, count); + struct d2d_effect *effect = impl_from_ID2D1Effect(iface); + unsigned int i;
- return E_NOTIMPL; + TRACE("iface %p, count %u.\n", iface, count); + + if (count < effect->info->min_inputs || count > effect->info->max_inputs) + return E_INVALIDARG; + if (count == effect->input_count) + return S_OK; + + if (count < effect->input_count) + { + for (i = count; i < effect->input_count; ++i) + { + if (effect->inputs[i]) + ID2D1Image_Release(effect->inputs[i]); + } + effect->input_count = count; + return S_OK; + } + + if (!d2d_array_reserve((void **)&effect->inputs, &effect->inputs_size, + count, sizeof(*effect->inputs))) + { + ERR("Failed to resize inputs array.\n"); + return E_OUTOFMEMORY; + } + + memset(&effect->inputs[effect->input_count], 0, sizeof(*effect->inputs) * (count - effect->input_count)); + effect->input_count = count; + + return S_OK; }
static void STDMETHODCALLTYPE d2d_effect_GetInput(ID2D1Effect *iface, UINT32 index, ID2D1Image **input) @@ -326,15 +349,9 @@ HRESULT d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory, const { if (IsEqualGUID(effect_id, builtin_effects[i].clsid)) { - effect->input_count = builtin_effects[i].default_input_count; - - 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); - + effect->info = &builtin_effects[i]; + d2d_effect_SetInputCount(&effect->ID2D1Effect_iface, effect->info->default_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 a6f7ac88d0d..f655274754e 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9811,10 +9811,8 @@ static void test_effect(BOOL d3d11) winetest_push_context("Input %u", j); hr = ID2D1Effect_SetInputCount(effect, j); if (j < test->min_inputs || j > test->max_inputs) - todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); else - todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); winetest_pop_context(); }
Signed-off-by: Ziqing Hui zhui@codeweavers.com ---
This supersedes 210310. Changes: Index static standard properties by a switch instead of a fixed size array.
dlls/d2d1/effect.c | 38 +++++++++++++++++++++++++++++++++++--- dlls/d2d1/tests/d2d1.c | 8 +++++--- 2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index ef1189ba042..5f334d19f71 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -164,10 +164,42 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_GetValueByName(ID2D1Effect *iface, c static HRESULT STDMETHODCALLTYPE d2d_effect_GetValue(ID2D1Effect *iface, UINT32 index, D2D1_PROPERTY_TYPE type, BYTE *value, UINT32 value_size) { - FIXME("iface %p, index %u, type %#x, value %p, value_size %u stub!\n", iface, index, type, - value, value_size); + struct d2d_effect *effect = impl_from_ID2D1Effect(iface); + const void *src;
- return E_NOTIMPL; + TRACE("iface %p, index %u, type %#x, value %p, value_size %u.\n", iface, index, type, value, value_size); + + switch (index) + { + case D2D1_PROPERTY_CLSID: + if ((type != D2D1_PROPERTY_TYPE_UNKNOWN && type != D2D1_PROPERTY_TYPE_CLSID) + || value_size != sizeof(*effect->info->clsid)) + return E_INVALIDARG; + src = effect->info->clsid; + break; + case D2D1_PROPERTY_MIN_INPUTS: + if ((type != D2D1_PROPERTY_TYPE_UNKNOWN && type != D2D1_PROPERTY_TYPE_UINT32) + || value_size != sizeof(effect->info->min_inputs)) + return E_INVALIDARG; + src = &effect->info->min_inputs; + break; + case D2D1_PROPERTY_MAX_INPUTS: + if ((type != D2D1_PROPERTY_TYPE_UNKNOWN && type != D2D1_PROPERTY_TYPE_UINT32) + || value_size != sizeof(effect->info->max_inputs)) + return E_INVALIDARG; + src = &effect->info->max_inputs; + break; + default: + if (index < D2D1_PROPERTY_CLSID) + FIXME("Custom properties are not supported.\n"); + else if (index <= D2D1_PROPERTY_MAX_INPUTS) + FIXME("Standard property %#x is not supported.\n", index); + return D2DERR_INVALID_PROPERTY; + } + + memcpy(value, src, value_size); + + return S_OK; }
static UINT32 STDMETHODCALLTYPE d2d_effect_GetValueSize(ID2D1Effect *iface, UINT32 index) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index f655274754e..343a2363e14 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9738,8 +9738,6 @@ static void test_effect(BOOL d3d11) ID2D1Image_Release(image_b); ID2D1Image_Release(image_a);
- todo_wine - { hr = ID2D1Effect_GetValue(effect, 0xdeadbeef, D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid)); ok(hr == D2DERR_INVALID_PROPERTY, "Got unexpected hr %#x.\n", hr);
@@ -9751,11 +9749,14 @@ static void test_effect(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, sizeof(buffer)); + todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); str_size = (wcslen((WCHAR *)buffer) + 1) * sizeof(WCHAR); hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, str_size); + todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, str_size - 1); + todo_wine ok(hr == D2DERR_INSUFFICIENT_BUFFER, "Got unexpected hr %#x.\n", hr);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, 0xdeadbeef, (BYTE *)&clsid, sizeof(clsid)); @@ -9776,12 +9777,14 @@ static void test_effect(BOOL d3d11)
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CACHED, D2D1_PROPERTY_TYPE_BOOL, (BYTE *)&cached, sizeof(cached)); + todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); if (hr == S_OK) ok(cached == FALSE, "Got unexpected cached %d.\n", cached);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_PRECISION, D2D1_PROPERTY_TYPE_ENUM, (BYTE *)&precision, sizeof(precision)); + todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); if (hr == S_OK) ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %u.\n", precision); @@ -9799,7 +9802,6 @@ static void test_effect(BOOL d3d11) if (hr == S_OK) ok(max_inputs == test->max_inputs, "Got unexpected max inputs %u, expected %u.\n", max_inputs, test->max_inputs); - }
input_count = ID2D1Effect_GetInputCount(effect); ok (input_count == test->default_input_count, "Got unexpected input count %u, expected %u.\n",
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=95353
Your paranoid android.
=== debiant2 (32 bit Japanese:Japan report) ===
Report validation errors: d2d1:d2d1 is missing some skip messages
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com