[PATCH 5/6] d2d1/effect: Support parsing int32 property values.
Nikolay Sivov
wine at gitlab.winehq.org
Sat Jul 2 09:49:22 CDT 2022
From: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/d2d1/effect.c | 3 ++-
dlls/d2d1/tests/d2d1.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index 154b3c35a1b..2a980dd33a6 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -267,7 +267,7 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties *
0, /* D2D1_PROPERTY_TYPE_STRING */
sizeof(BOOL), /* D2D1_PROPERTY_TYPE_BOOL */
sizeof(UINT32), /* D2D1_PROPERTY_TYPE_UINT32 */
- sizeof(INT32), /* D2D1_PROPERTY_TYPE_IN32 */
+ sizeof(INT32), /* D2D1_PROPERTY_TYPE_INT32 */
sizeof(float), /* D2D1_PROPERTY_TYPE_FLOAT */
2 * sizeof(float), /* D2D1_PROPERTY_TYPE_VECTOR2 */
3 * sizeof(float), /* D2D1_PROPERTY_TYPE_VECTOR3 */
@@ -345,6 +345,7 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties *
switch (p->type)
{
case D2D1_PROPERTY_TYPE_UINT32:
+ case D2D1_PROPERTY_TYPE_INT32:
case D2D1_PROPERTY_TYPE_ENUM:
_uint32 = wcstoul(value, NULL, 10);
src = &_uint32;
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index d796d738077..aa2e98aa22a 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -50,6 +50,14 @@ L"<?xml version='1.0'?> \
<Property name='Max' type='uint32' value='100'/> \
<Property name='Default' type='uint32' value='10'/> \
</Property> \
+ <Property name='Int32Prop' type='int32' value='-2'> \
+ <Property name='DisplayName' type='string' value='Int32 prop'/> \
+ <Property name='Default' type='int32' value='10'/> \
+ </Property> \
+ <Property name='UInt32Prop' type='uint32' value='-3'> \
+ <Property name='DisplayName' type='string' value='UInt32 prop'/> \
+ <Property name='Default' type='uint32' value='10'/> \
+ </Property> \
<Property name='Bool' type='bool'> \
<Property name='DisplayName' type='string' value='Bool property'/> \
<Property name='Default' type='bool' value='false'/> \
@@ -11042,6 +11050,7 @@ static void test_effect_properties(BOOL d3d11)
ID2D1Effect *effect;
UINT32 count, data;
WCHAR buffer[128];
+ INT32 _int32;
CLSID clsid;
BOOL cached;
HRESULT hr;
@@ -11133,6 +11142,28 @@ static void test_effect_properties(BOOL d3d11)
ID2D1Properties_Release(subproperties);
+ /* Int32 property. */
+ index = ID2D1Effect_GetPropertyIndex(effect, L"Int32Prop");
+ hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(!wcscmp(buffer, L"Int32Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
+ prop_type = ID2D1Effect_GetType(effect, index);
+ ok(prop_type == D2D1_PROPERTY_TYPE_INT32, "Unexpected type %u.\n", prop_type);
+ hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_INT32, (BYTE *)&_int32, sizeof(_int32));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(_int32 == -2, "Unexpected value %d.\n", _int32);
+
+ /* UInt32 property. */
+ index = ID2D1Effect_GetPropertyIndex(effect, L"UInt32Prop");
+ hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(!wcscmp(buffer, L"UInt32Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
+ prop_type = ID2D1Effect_GetType(effect, index);
+ ok(prop_type == D2D1_PROPERTY_TYPE_UINT32, "Unexpected type %u.\n", prop_type);
+ hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(integer == -3, "Unexpected value %u.\n", integer);
+
/* Vector2 property. */
index = ID2D1Effect_GetPropertyIndex(effect, L"Vec2Prop");
hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/361
More information about the wine-devel
mailing list