[PATCH 4/6] d2d1/effect: Support parsing vector4 property values.

Nikolay Sivov wine at gitlab.winehq.org
Sat Jul 2 09:49:21 CDT 2022


From: Nikolay Sivov <nsivov at codeweavers.com>

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/d2d1/effect.c     |  1 +
 dlls/d2d1/tests/d2d1.c | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index a2cb08ac873..154b3c35a1b 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -361,6 +361,7 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties *
                     break;
                 case D2D1_PROPERTY_TYPE_VECTOR2:
                 case D2D1_PROPERTY_TYPE_VECTOR3:
+                case D2D1_PROPERTY_TYPE_VECTOR4:
                     if (FAILED(hr = d2d_effect_parse_vector_value(p->type, value, _vec)))
                     {
                         WARN("Failed to parse vector value %s.\n", wine_dbgstr_w(value));
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index f76ad185f3e..d796d738077 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -62,6 +62,10 @@ L"<?xml version='1.0'?>                                                       \
             <Property name='DisplayName' type='string' value='Vec3 prop'/>    \
             <Property name='Default' type='vector3' value='(0.1, 0.2, 0.3)'/> \
         </Property>                                                           \
+        <Property name='Vec4Prop' type='vector4' value='(8.0,9.0,10.0,11.0)'>   \
+            <Property name='DisplayName' type='string' value='Vec4 prop'/>      \
+            <Property name='Default' type='vector4' value='(0.8,0.9,1.0,1.1)'/> \
+        </Property>                                                             \
     </Effect>                                                                 \
 ";
 
@@ -11030,11 +11034,11 @@ static void test_effect_properties(BOOL d3d11)
     UINT32 i, min_inputs, max_inputs, integer, index, size;
     ID2D1EffectContext *effect_context;
     D2D1_BUFFER_PRECISION precision;
+    float vec2[2], vec3[3], vec4[4];
     ID2D1Properties *subproperties;
     D2D1_PROPERTY_TYPE prop_type;
     struct d2d1_test_context ctx;
     ID2D1Factory1 *factory;
-    float vec2[2], vec3[3];
     ID2D1Effect *effect;
     UINT32 count, data;
     WCHAR buffer[128];
@@ -11152,6 +11156,18 @@ static void test_effect_properties(BOOL d3d11)
     ok(vec3[0] == 5.0f && vec3[1] == 6.0f && vec3[2] == 7.0f, "Unexpected vector (%.8e,%.8e,%.8e).\n",
             vec3[0], vec3[1], vec3[2]);
 
+    /* Vector4 property. */
+    index = ID2D1Effect_GetPropertyIndex(effect, L"Vec4Prop");
+    hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
+    ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+    ok(!wcscmp(buffer, L"Vec4Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
+    prop_type = ID2D1Effect_GetType(effect, index);
+    ok(prop_type == D2D1_PROPERTY_TYPE_VECTOR4, "Unexpected type %u.\n", prop_type);
+    hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_VECTOR4, (BYTE *)vec4, sizeof(vec4));
+    ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+    ok(vec4[0] == 8.0f && vec4[1] == 9.0f && vec4[2] == 10.0f && vec4[3] == 11.0f,
+            "Unexpected vector (%.8e,%.8e,%.8e,%.8e).\n", vec4[0], vec4[1], vec4[2], vec4[3]);
+
     ID2D1Effect_Release(effect);
 
     hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/361



More information about the wine-devel mailing list