[PATCH 2/3] d2d1: Implement effect creation for registered effect.
Ziqing Hui
zhui at codeweavers.com
Mon Jun 20 22:17:07 CDT 2022
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---
dlls/d2d1/d2d1_private.h | 3 +
dlls/d2d1/effect.c | 127 ++++++++++++++++++++++---
dlls/d2d1/factory.c | 8 ++
dlls/d2d1/tests/d2d1.c | 196 +++++++++++++++++----------------------
4 files changed, 213 insertions(+), 121 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 75a9c4f9366..ffe1cd9e1dc 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -78,6 +78,8 @@ struct d2d_factory
CRITICAL_SECTION cs;
};
+struct d2d_factory *unsafe_impl_from_ID2D1Factory3(ID2D1Factory3 *iface) DECLSPEC_HIDDEN;
+
struct d2d_clip_stack
{
D2D1_RECT_F *stack;
@@ -655,6 +657,7 @@ struct d2d_effect
UINT32 min_inputs;
UINT32 max_inputs;
+ ID2D1EffectImpl *impl;
struct d2d_effect_context *effect_context;
ID2D1Image **inputs;
size_t inputs_size;
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index a87fedd0742..c1ef67c89aa 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -20,6 +20,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
+struct d2d_effect_impl
+{
+ ID2D1EffectImpl ID2D1EffectImpl_iface;
+ LONG refcount;
+};
+
struct d2d_builtin_effect_registration
{
const CLSID *id;
@@ -29,14 +35,98 @@ struct d2d_builtin_effect_registration
UINT32 max_inputs;
};
+static inline struct d2d_effect_impl *impl_from_ID2D1EffectImpl(ID2D1EffectImpl *iface)
+{
+ return CONTAINING_RECORD(iface, struct d2d_effect_impl, ID2D1EffectImpl_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_effect_impl_QueryInterface(ID2D1EffectImpl *iface, REFIID iid, void **out)
+{
+ TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(iid, &IID_ID2D1EffectImpl)
+ || IsEqualGUID(iid, &IID_IUnknown))
+ {
+ ID2D1EffectImpl_AddRef(iface);
+ *out = iface;
+ return S_OK;
+ }
+
+ *out = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG STDMETHODCALLTYPE d2d_effect_impl_AddRef(ID2D1EffectImpl *iface)
+{
+ struct d2d_effect_impl *effect_impl =impl_from_ID2D1EffectImpl(iface);
+ ULONG refcount = InterlockedIncrement(&effect_impl->refcount);
+
+ TRACE("%p increasing refcount to %lu.\n", iface, refcount);
+
+ return refcount;
+}
+
+static ULONG STDMETHODCALLTYPE d2d_effect_impl_Release(ID2D1EffectImpl *iface)
+{
+ struct d2d_effect_impl *effect_impl = impl_from_ID2D1EffectImpl(iface);
+ ULONG refcount = InterlockedDecrement(&effect_impl->refcount);
+
+ TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
+
+ if (!refcount)
+ free(effect_impl);
+
+ return refcount;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_effect_impl_Initialize(ID2D1EffectImpl *iface,
+ ID2D1EffectContext *context, ID2D1TransformGraph *graph)
+{
+ return S_OK;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_effect_impl_PrepareForRender(ID2D1EffectImpl *iface, D2D1_CHANGE_TYPE type)
+{
+ return S_OK;
+}
+
+static HRESULT STDMETHODCALLTYPE d2d_effect_impl_SetGraph(ID2D1EffectImpl *iface, ID2D1TransformGraph *graph)
+{
+ return E_NOTIMPL;
+}
+
+static const ID2D1EffectImplVtbl d2d_effect_impl_vtbl =
+{
+ d2d_effect_impl_QueryInterface,
+ d2d_effect_impl_AddRef,
+ d2d_effect_impl_Release,
+ d2d_effect_impl_Initialize,
+ d2d_effect_impl_PrepareForRender,
+ d2d_effect_impl_SetGraph,
+};
+
+static HRESULT STDMETHODCALLTYPE d2d_effect_impl_create(IUnknown **effect_impl)
+{
+ struct d2d_effect_impl *object;
+
+ if (!(object = calloc(1, sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ object->ID2D1EffectImpl_iface.lpVtbl = &d2d_effect_impl_vtbl;
+ object->refcount = 1;
+
+ *effect_impl = (IUnknown *)&object->ID2D1EffectImpl_iface;
+ return S_OK;
+}
+
static const struct d2d_builtin_effect_registration builtin_effects[] =
{
- {&CLSID_D2D12DAffineTransform, NULL, 1, 1, 1},
- {&CLSID_D2D13DPerspectiveTransform, NULL, 1, 1, 1},
- {&CLSID_D2D1Composite, NULL, 2, 1, 0xffffffff},
- {&CLSID_D2D1Crop, NULL, 1, 1, 1},
- {&CLSID_D2D1Shadow, NULL, 1, 1, 1},
- {&CLSID_D2D1Grayscale, NULL, 1, 1, 1},
+ {&CLSID_D2D12DAffineTransform, d2d_effect_impl_create, 1, 1, 1},
+ {&CLSID_D2D13DPerspectiveTransform, d2d_effect_impl_create, 1, 1, 1},
+ {&CLSID_D2D1Composite, d2d_effect_impl_create, 2, 1, 0xffffffff},
+ {&CLSID_D2D1Crop, d2d_effect_impl_create, 1, 1, 1},
+ {&CLSID_D2D1Shadow, d2d_effect_impl_create, 1, 1, 1},
+ {&CLSID_D2D1Grayscale, d2d_effect_impl_create, 1, 1, 1},
};
static inline struct d2d_effect_context *impl_from_ID2D1EffectContext(ID2D1EffectContext *iface)
@@ -433,6 +523,7 @@ static void d2d_effect_cleanup(struct d2d_effect *effect)
}
free(effect->inputs);
ID2D1EffectContext_Release(&effect->effect_context->ID2D1EffectContext_iface);
+ ID2D1EffectImpl_Release(effect->impl);
}
static HRESULT STDMETHODCALLTYPE d2d_effect_QueryInterface(ID2D1Effect *iface, REFIID iid, void **out)
@@ -761,21 +852,33 @@ static const ID2D1ImageVtbl d2d_effect_image_vtbl =
HRESULT d2d_effect_init(struct d2d_effect *effect, struct d2d_effect_context *effect_context, const CLSID *effect_id)
{
- unsigned int i;
+ struct d2d_effect_registration *reg;
+ struct d2d_factory *factory;
+ HRESULT hr;
effect->ID2D1Effect_iface.lpVtbl = &d2d_effect_vtbl;
effect->ID2D1Image_iface.lpVtbl = &d2d_effect_image_vtbl;
effect->refcount = 1;
- for (i = 0; i < ARRAY_SIZE(builtin_effects); ++i)
+ factory = unsafe_impl_from_ID2D1Factory3((ID2D1Factory3 *)effect_context->device_context->factory);
+ LIST_FOR_EACH_ENTRY(reg, &factory->effects, struct d2d_effect_registration, entry)
{
- if (IsEqualGUID(effect_id, &builtin_effects[i].id))
+ if (IsEqualGUID(effect_id, ®->id))
{
- effect->min_inputs = builtin_effects[i].min_inputs;
- effect->max_inputs = builtin_effects[i].max_inputs;
- d2d_effect_SetInputCount(&effect->ID2D1Effect_iface, builtin_effects[i].default_input_count);
+ if (FAILED(hr = reg->factory((IUnknown **)&effect->impl)))
+ return hr;
+ if (FAILED(hr = ID2D1EffectImpl_Initialize(effect->impl, &effect_context->ID2D1EffectContext_iface, NULL)))
+ {
+ ID2D1EffectImpl_Release(effect->impl);
+ return hr;
+ }
+ effect->id = *effect_id;
+ effect->min_inputs = reg->min_inputs;
+ effect->max_inputs = reg->max_inputs;
+ d2d_effect_SetInputCount(&effect->ID2D1Effect_iface, reg->default_input_count);
effect->effect_context = effect_context;
ID2D1EffectContext_AddRef(&effect_context->ID2D1EffectContext_iface);
+ /* FIXME: Properties are ignored. */
return S_OK;
}
}
diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index 7eec52c01a1..9f458b07fd9 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -1091,6 +1091,14 @@ static void d2d_factory_init(struct d2d_factory *factory, D2D1_FACTORY_TYPE fact
InitializeCriticalSection(&factory->cs);
}
+struct d2d_factory *unsafe_impl_from_ID2D1Factory3(ID2D1Factory3 *iface)
+{
+ if (!iface)
+ return NULL;
+ assert(iface->lpVtbl == &d2d_factory_vtbl);
+ return CONTAINING_RECORD(iface, struct d2d_factory, ID2D1Factory3_iface);
+}
+
HRESULT WINAPI D2D1CreateFactory(D2D1_FACTORY_TYPE factory_type, REFIID iid,
const D2D1_FACTORY_OPTIONS *factory_options, void **factory)
{
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index f1cec1d7a0b..d749bc63b20 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -10719,15 +10719,13 @@ static void test_effect_register(BOOL d3d11)
ok(hr == test->hr, "Got unexpected hr %#lx, expected %#lx.\n", hr, test->hr);
if (hr == S_OK)
{
- effect = NULL;
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
- todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr);
- if (effect)
- ID2D1Effect_Release(effect);
+ ID2D1Effect_Release(effect);
}
winetest_pop_context();
@@ -10762,29 +10760,23 @@ static void test_effect_register(BOOL d3d11)
effect_xml_a, NULL, 0, effect_impl_create);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
+ D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- if (hr == S_OK)
- {
- hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
- D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
- ID2D1Effect_Release(effect);
- }
+ todo_wine ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
+ ID2D1Effect_Release(effect);
hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
effect_xml_b, NULL, 0, effect_impl_create);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
+ D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- if (hr == S_OK)
- {
- hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
- D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
- ID2D1Effect_Release(effect);
- }
+ todo_wine ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
+ ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
@@ -10810,41 +10802,35 @@ static void test_effect_register(BOOL d3d11)
effect_xml_c, binding, 1, effect_impl_create);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ integer = 0xdeadbeef;
+ effect_context = (ID2D1EffectContext *)0xdeadbeef;
+ hr = ID2D1Effect_GetValueByName(effect, L"Integer",
+ D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- if (hr == S_OK)
- {
- integer = 0xdeadbeef;
- effect_context = (ID2D1EffectContext *)0xdeadbeef;
- hr = ID2D1Effect_GetValueByName(effect, L"Integer",
- D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- hr = ID2D1Effect_GetValueByName(effect, L"Context",
- D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(integer == 10, "Got unexpected integer %u.\n", integer);
- ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
- ID2D1Effect_Release(effect);
- }
+ hr = ID2D1Effect_GetValueByName(effect, L"Context",
+ D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(integer == 10, "Got unexpected integer %u.\n", integer);
+ todo_wine ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
+ ID2D1Effect_Release(effect);
hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
effect_xml_c, binding + 1, 1, effect_impl_create);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ integer = 0xdeadbeef;
+ effect_context = (ID2D1EffectContext *)0xdeadbeef;
+ hr = ID2D1Effect_GetValueByName(effect, L"Integer",
+ D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- if (hr == S_OK)
- {
- integer = 0xdeadbeef;
- effect_context = (ID2D1EffectContext *)0xdeadbeef;
- hr = ID2D1Effect_GetValueByName(effect, L"Integer",
- D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- hr = ID2D1Effect_GetValueByName(effect, L"Context",
- D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(integer == 10, "Got unexpected integer %u.\n", integer);
- ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
- ID2D1Effect_Release(effect);
- }
+ hr = ID2D1Effect_GetValueByName(effect, L"Context",
+ D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(integer == 10, "Got unexpected integer %u.\n", integer);
+ todo_wine ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
+ ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
@@ -10863,8 +10849,8 @@ static void test_effect_context(BOOL d3d11)
ID2D1EffectContext *effect_context;
D2D1_PROPERTY_BINDING binding;
struct d2d1_test_context ctx;
- ID2D1Effect *effect = NULL;
ID2D1Factory1 *factory;
+ ID2D1Effect *effect;
BOOL loaded;
HRESULT hr;
@@ -10887,12 +10873,10 @@ static void test_effect_context(BOOL d3d11)
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
- todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- if (hr != S_OK)
- goto done;
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_GetValueByName(effect, L"Context",
D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
if (hr != S_OK)
goto done;
@@ -10928,8 +10912,7 @@ static void test_effect_context(BOOL d3d11)
ok(loaded, "Shader is not loaded.\n");
done:
- if (effect)
- ID2D1Effect_Release(effect);
+ ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
release_test_context(&ctx);
@@ -10997,11 +10980,8 @@ static void test_effect_properties(BOOL d3d11)
hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, test->xml, NULL, 0, effect_impl_create);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- effect = NULL;
hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
- todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- if (hr != S_OK)
- goto next;
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID,
D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid));
@@ -11009,67 +10989,73 @@ static void test_effect_properties(BOOL d3d11)
ok(IsEqualGUID(&clsid, &CLSID_TestEffect), "Got unexpected clsid %s, expected %s.\n",
debugstr_guid(&clsid), debugstr_guid(&CLSID_TestEffect));
+ wcscpy(buffer, L"DeadBeef");
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(!wcscmp(buffer, test->display_name), "Got unexpected display name %s, expected %s.\n",
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(!wcscmp(buffer, test->display_name), "Got unexpected display name %s, expected %s.\n",
debugstr_w(buffer), debugstr_w(test->display_name));
+ wcscpy(buffer, L"DeadBeef");
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_AUTHOR,
D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(!wcscmp(buffer, test->author), "Got unexpected author %s, expected %s.\n",
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(!wcscmp(buffer, test->author), "Got unexpected author %s, expected %s.\n",
debugstr_w(buffer), debugstr_w(test->author));
+ wcscpy(buffer, L"DeadBeef");
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CATEGORY,
D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(!wcscmp(buffer, test->category), "Got unexpected category %s, expected %s.\n",
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(!wcscmp(buffer, test->category), "Got unexpected category %s, expected %s.\n",
debugstr_w(buffer), debugstr_w(test->category));
+ wcscpy(buffer, L"DeadBeef");
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DESCRIPTION,
D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(!wcscmp(buffer, test->description), "Got unexpected description %s, expected %s.\n",
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(!wcscmp(buffer, test->description), "Got unexpected description %s, expected %s.\n",
debugstr_w(buffer), debugstr_w(test->description));
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CACHED,
D2D1_PROPERTY_TYPE_BOOL, (BYTE *)&cached, sizeof(cached));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(cached == FALSE, "Got unexpected cached %d.\n", cached);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(cached == FALSE, "Got unexpected cached %d.\n", cached);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_PRECISION,
D2D1_PROPERTY_TYPE_ENUM, (BYTE *)&precision, sizeof(precision));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %#x.\n", precision);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %#x.\n", precision);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine_if(test->max_inputs != 0)
ok(min_inputs == test->min_inputs, "Got unexpected min inputs %u, expected %u.\n",
min_inputs, test->min_inputs);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MAX_INPUTS,
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine_if(test->max_inputs != 0)
ok(max_inputs == test->max_inputs, "Got unexpected max inputs %u, expected %u.\n",
max_inputs, test->max_inputs);
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_CLSID,
D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid));
- ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
- ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_AUTHOR,
D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
- ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_CATEGORY,
D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
- ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
- ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_CACHED,
D2D1_PROPERTY_TYPE_BOOL, (BYTE *)&cached, sizeof(cached));
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
@@ -11078,14 +11064,12 @@ static void test_effect_properties(BOOL d3d11)
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
- ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_MAX_INPUTS,
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
- ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
- next:
- if (effect)
- ID2D1Effect_Release(effect);
+ ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
winetest_pop_context();
@@ -11097,50 +11081,47 @@ static void test_effect_properties(BOOL d3d11)
effect_xml_c, binding, 2, effect_impl_create);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- effect = NULL;
hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
- todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- if (hr != S_OK)
- goto done;
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
index = ID2D1Effect_GetPropertyIndex(effect, L"Context");
ok(index == 0, "Got unexpected index %u.\n", index);
index = ID2D1Effect_GetPropertyIndex(effect, L"Integer");
- ok(index == 1, "Got unexpected index %u.\n", index);
+ todo_wine ok(index == 1, "Got unexpected index %u.\n", index);
effect_context = (ID2D1EffectContext *)0xdeadbeef;
hr = ID2D1Effect_GetValueByName(effect,
L"Context", D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(effect_context != NULL && effect_context != (ID2D1EffectContext *)0xdeadbeef,
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(effect_context != NULL && effect_context != (ID2D1EffectContext *)0xdeadbeef,
"Got unexpected effect context %p.\n", effect_context);
effect_context = (ID2D1EffectContext *)0xdeadbeef;
hr = ID2D1Effect_GetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(effect_context != NULL && effect_context != (ID2D1EffectContext *)0xdeadbeef,
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(effect_context != NULL && effect_context != (ID2D1EffectContext *)0xdeadbeef,
"Got unexpected effect context %p.\n", effect_context);
hr = ID2D1Effect_SetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
- ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
integer = 0xdeadbeef;
hr = ID2D1Effect_GetValueByName(effect, L"Integer", D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(integer == 10, "Got unexpected integer %u.", integer);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(integer == 10, "Got unexpected integer %u.", integer);
integer = 0xdeadbeef;
hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(integer == 10, "Got unexpected integer %u.", integer);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(integer == 10, "Got unexpected integer %u.", integer);
integer = 20;
hr = ID2D1Effect_SetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
integer = 0xdeadbeef;
hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(integer == 20, "Got unexpected integer %u.", integer);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(integer == 20, "Got unexpected integer %u.", integer);
ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
@@ -11156,32 +11137,29 @@ static void test_effect_properties(BOOL d3d11)
index = ID2D1Effect_GetPropertyIndex(effect, L"Context");
ok(index == 0, "Got unexpected index %u.\n", index);
index = ID2D1Effect_GetPropertyIndex(effect, L"Integer");
- ok(index == 1, "Got unexpected index %u.\n", index);
+ todo_wine ok(index == 1, "Got unexpected index %u.\n", index);
hr = ID2D1Effect_GetValueByName(effect, L"DeadBeef", D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
- ok(hr == D2DERR_INVALID_PROPERTY, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == D2DERR_INVALID_PROPERTY, "Got unexpected hr %#lx.\n", hr);
effect_context = (ID2D1EffectContext *)0xdeadbeef;
hr = ID2D1Effect_GetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
integer = 0xdeadbeef;
hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
- ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- ok(integer == 0, "Got unexpected integer %u.", integer);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(integer == 0, "Got unexpected integer %u.", integer);
hr = ID2D1Effect_SetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
- ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = ID2D1Effect_SetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
- ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
+ todo_wine ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
-done:
- if (effect)
- ID2D1Effect_Release(effect);
+ ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
-
release_test_context(&ctx);
}
--
2.25.1
More information about the wine-devel
mailing list