From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d2d1/effect.c | 1 + dlls/d2d1/tests/d2d1.c | 81 +++++++++++++++++++++++++++++++++++++++++ include/d2d1effects.idl | 6 +++ 3 files changed, 88 insertions(+)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index 69372de2d8c..55d8e1b5018 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -1099,6 +1099,7 @@ L"<?xml version='1.0'?> \ <Property name='Description' type='string' value='Flood'/> \ <Inputs minimum='0' maximum='0' > \ </Inputs> \ + <Property name='Color' type='vector4' /> \ </Effect>";
static const WCHAR gaussian_blur_description[] = diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 396316d160c..dc8b8486a47 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -13591,6 +13591,86 @@ static void test_effect_shadow(BOOL d3d11) release_test_context(&ctx); }
+static void test_effect_flood(BOOL d3d11) +{ + static const struct effect_property properties[] = + { + { L"Color", D2D1_FLOOD_PROP_COLOR, D2D1_PROPERTY_TYPE_VECTOR4 }, + }; + static const float bound = (float)INT_MAX; + struct d2d1_test_context ctx; + ID2D1DeviceContext *context; + unsigned int count, i; + ID2D1Effect *effect; + D2D_VECTOR_4F vec4; + ID2D1Image *output; + D2D1_RECT_F bounds; + D2D1_COLOR_F color; + WCHAR name[64]; + BOOL match; + HRESULT hr; + + if (!init_test_context(&ctx, d3d11)) + return; + + context = ctx.context; + + hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D1Flood, &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)); + } + + vec4 = effect_get_vec4_prop(effect, D2D1_FLOOD_PROP_COLOR); + todo_wine + ok(vec4.x == 0.0f && vec4.y == 0.0f && vec4.z == 0.0f && vec4.w == 1.0f, + "Unexpected value {%.8e,%.8e,%.8e,%.8e}.\n", vec4.x, vec4.y, vec4.z, vec4.w); + + ID2D1Effect_GetOutput(effect, &output); + + hr = ID2D1DeviceContext_GetImageLocalBounds(context, output, &bounds); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + todo_wine + ok(compare_rect(&bounds, -bound, -bound, bound, bound, 0), + "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n", + bounds.left, bounds.top, bounds.right, bounds.bottom); + + set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f); + hr = ID2D1Effect_SetValue(effect, D2D1_FLOOD_PROP_COLOR, D2D1_PROPERTY_TYPE_VECTOR4, + (const BYTE *)&color, sizeof(color)); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + ID2D1DeviceContext_BeginDraw(context); + + set_color(&color, 1.0f, 1.0f, 0.0f, 1.0f); + ID2D1DeviceContext_Clear(context, &color); + + ID2D1DeviceContext_DrawImage(context, output, NULL, NULL, D2D1_INTERPOLATION_MODE_LINEAR, + D2D1_COMPOSITE_MODE_SOURCE_OVER); + + hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + match = compare_surface(&ctx, "6527ec83b4039c895b50f9b3e144fe0cf90d1889"); + todo_wine + ok(match, "Surface does not match.\n"); + + ID2D1Image_Release(output); + + ID2D1Effect_Release(effect); + release_test_context(&ctx); +} + static void test_registered_effects(BOOL d3d11) { UINT32 ret, count, count2, count3; @@ -16968,6 +17048,7 @@ START_TEST(d2d1) queue_d3d10_test(test_effect_point_specular); queue_d3d10_test(test_effect_arithmetic_composite); queue_d3d10_test(test_effect_shadow); + queue_test(test_effect_flood); 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 9cba0e472e9..efaeba5c92d 100644 --- a/include/d2d1effects.idl +++ b/include/d2d1effects.idl @@ -213,3 +213,9 @@ typedef enum D2D1_SHADOW_OPTIMIZATION D2D1_SHADOW_OPTIMIZATION_QUALITY = 2, D2D1_SHADOW_OPTIMIZATION_FORCE_DWORD = 0xffffffff } D2D1_SHADOW_OPTIMIZATION; + +typedef enum D2D1_FLOOD_PROP +{ + D2D1_FLOOD_PROP_COLOR = 0, + D2D1_FLOOD_PROP_FORCE_DWORD = 0xffffffff +} D2D1_FLOOD_PROP;