From: Alfred Agrell floating@muncher.se
--- dlls/d2d1/effect.c | 36 +++++++++++++++++++++++++++++++++++ dlls/d2d1/tests/d2d1.c | 42 +++++++++++++++++++++++++++++++++++++++++ include/d2d1effects.idl | 6 ++++++ 3 files changed, 84 insertions(+)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index 003fdb02e5d..130e6cc2e98 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -1570,6 +1570,41 @@ static HRESULT __stdcall arithmetic_composite_factory(IUnknown **effect) return d2d_effect_create_impl(effect, &properties, sizeof(properties)); }
+static const WCHAR blend_description[] = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string' value='Blend'/> \ + <Property name='Author' type='string' value='The Wine Project'/> \ + <Property name='Category' type='string' value='Stub'/> \ + <Property name='Description' type='string' value='Blend'/> \ + <Inputs minimum='2' maximum='2' > \ + <Input name='Source1'/> \ + <Input name='Source2'/> \ + </Inputs> \ + <Property name='Mode' type='enum' /> \ + </Effect>"; + +struct blend_properties +{ + D2D1_BLEND_MODE mode; +}; + +EFFECT_PROPERTY_RW(blend, mode, ENUM) + +static const D2D1_PROPERTY_BINDING blend_bindings[] = +{ + { L"Mode", BINDING_RW(blend, mode) }, +}; + +static HRESULT __stdcall blend_factory(IUnknown **effect) +{ + static const struct blend_properties properties = + { + .mode = D2D1_BLEND_MODE_MULTIPLY, + }; + return d2d_effect_create_impl(effect, &properties, sizeof(properties)); +} + void d2d_effects_init_builtins(struct d2d_factory *factory) { static const struct builtin_description @@ -1595,6 +1630,7 @@ void d2d_effects_init_builtins(struct d2d_factory *factory) { &CLSID_D2D1GaussianBlur, X2(gaussian_blur) }, { &CLSID_D2D1PointSpecular, X2(point_specular) }, { &CLSID_D2D1ArithmeticComposite, X2(arithmetic_composite) }, + { &CLSID_D2D1Blend, X2(blend) }, #undef X2 #undef X }; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 556d93a970f..2cd11fcb81d 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -13986,6 +13986,47 @@ static void test_effect_color_matrix(BOOL d3d11) release_test_context(&ctx); }
+static void test_effect_blend(BOOL d3d11) +{ + static const struct effect_property properties[] = + { + { L"Mode", D2D1_BLEND_PROP_MODE, D2D1_PROPERTY_TYPE_ENUM }, + }; + D2D1_BLEND_MODE mode; + struct d2d1_test_context ctx; + ID2D1DeviceContext *context; + unsigned int count, i; + ID2D1Effect *effect; + WCHAR name[64]; + HRESULT hr; + + if (!init_test_context(&ctx, d3d11)) + return; + + context = ctx.context; + + hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D1Blend, &effect); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + check_system_properties(effect); + + count = ID2D1Effect_GetPropertyCount(effect); + ok(count == 1, "Got unexpected property count %u.\n", count); + + for (i = 0; i < ARRAY_SIZE(properties); ++i) + { + hr = ID2D1Effect_GetPropertyName(effect, properties[i].index, name, 64); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(name, properties[i].name), "Unexpected name %s.\n", wine_dbgstr_w(name)); + } + + mode = effect_get_enum_prop(effect, D2D1_BLEND_PROP_MODE); + ok(mode == D2D1_BLEND_MODE_MULTIPLY, "got %d.\n", mode); + + ID2D1Effect_Release(effect); + release_test_context(&ctx); +} + static void test_registered_effects(BOOL d3d11) { UINT32 ret, count, count2, count3; @@ -17368,6 +17409,7 @@ START_TEST(d2d1) queue_d3d10_test(test_effect_composite); queue_d3d10_test(test_effect_color_matrix); queue_test(test_effect_flood); + queue_test(test_effect_blend); queue_test(test_transform_graph); queue_test(test_offset_transform); queue_test(test_blend_transform); diff --git a/include/d2d1effects.idl b/include/d2d1effects.idl index 5534314468e..e65520ba9f1 100644 --- a/include/d2d1effects.idl +++ b/include/d2d1effects.idl @@ -234,3 +234,9 @@ typedef enum D2D1_COLORMATRIX_ALPHA_MODE D2D1_COLORMATRIX_ALPHA_MODE_STRAIGHT = 2, D2D1_COLORMATRIX_ALPHA_MODE_FORCE_DWORD = 0xffffffff } D2D1_COLORMATRIX_ALPHA_MODE; + +typedef enum D2D1_BLEND_PROP +{ + D2D1_BLEND_PROP_MODE = 0, + D2D1_BLEND_PROP_FORCE_DWORD = 0xffffffff +} D2D1_BLEND_PROP;