From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/xmllite/reader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index d99f121e0cb..118b7bd5ea2 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -1030,7 +1030,7 @@ static void readerinput_switchencoding(xmlreaderinput *readerinput, xml_encoding { readerinput_grow(readerinput, len); memcpy(dest->data, src->data + src->cur, len); - dest->written += len*sizeof(WCHAR); + dest->written += len; } else { @@ -1084,7 +1084,7 @@ static HRESULT reader_more(xmlreader *reader) { readerinput_grow(readerinput, len); memcpy(dest->data + dest->written, src->data + src->cur, len); - dest->written += len*sizeof(WCHAR); + dest->written += len; } else {
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d2d1/effect.c | 39 +++++++++++++++++++++++++++++++++++++++ dlls/d2d1/tests/d2d1.c | 17 +++++++++++++++++ 2 files changed, 56 insertions(+)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index 5daf16fd838..7cfed6577c4 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -229,6 +229,35 @@ static const struct d2d_effect_info builtin_effects[] = {&CLSID_D2D1Grayscale, 1, 1, 1}, };
+/* Same syntax is used for value and default values. */ +static HRESULT d2d_effect_parse_vector_value(D2D1_PROPERTY_TYPE type, const WCHAR *value, + float *vec) +{ + unsigned int i, num_components; + WCHAR *end_ptr; + + assert(type == D2D1_PROPERTY_TYPE_VECTOR2 || type == D2D1_PROPERTY_TYPE_VECTOR3 + || type == D2D1_PROPERTY_TYPE_VECTOR4); + + if (*(value++) != '(') return E_INVALIDARG; + + /* Type values are sequential. */ + num_components = (type - D2D1_PROPERTY_TYPE_VECTOR2) + 2; + + for (i = 0; i < num_components; ++i) + { + vec[i] = wcstof(value, &end_ptr); + if (value == end_ptr) return E_INVALIDARG; + value = end_ptr; + + /* Trailing characters after last component are ignored. */ + if (i == num_components - 1) continue; + if (*(value++) != ',') return E_INVALIDARG; + } + + return S_OK; +} + static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties *props, const WCHAR *name, UINT32 index, BOOL subprop, D2D1_PROPERTY_TYPE type, const WCHAR *value) { @@ -255,6 +284,7 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties * sizeof(void *), /* D2D1_PROPERTY_TYPE_COLOR_CONTEXT */ }; struct d2d_effect_property *p; + HRESULT hr;
assert(type >= D2D1_PROPERTY_TYPE_STRING && type <= D2D1_PROPERTY_TYPE_COLOR_CONTEXT);
@@ -302,6 +332,7 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties * { void *src = NULL; UINT32 _uint32; + float _vec[4]; CLSID _clsid; BOOL _bool;
@@ -328,6 +359,14 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties * CLSIDFromString(value, &_clsid); src = &_clsid; break; + case D2D1_PROPERTY_TYPE_VECTOR2: + if (FAILED(hr = d2d_effect_parse_vector_value(p->type, value, _vec))) + { + WARN("Failed to parse vector value %s.\n", wine_dbgstr_w(value)); + return hr; + } + src = _vec; + break; case D2D1_PROPERTY_TYPE_IUNKNOWN: case D2D1_PROPERTY_TYPE_COLOR_CONTEXT: break; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 9dfe1e760ba..b7eab5003d7 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -54,6 +54,10 @@ L"<?xml version='1.0'?> \ <Property name='DisplayName' type='string' value='Bool property'/> \ <Property name='Default' type='bool' value='false'/> \ </Property> \ + <Property name='Vec2Prop' type='vector2' value='( 3.0, 4.0)'> \ + <Property name='DisplayName' type='string' value='Vec2 prop'/> \ + <Property name='Default' type='vector2' value='(1.0, 2.0)'/> \ + </Property> \ </Effect> \ ";
@@ -11029,6 +11033,7 @@ static void test_effect_properties(BOOL d3d11) ID2D1Effect *effect; UINT32 count, data; WCHAR buffer[128]; + float vec2[2]; CLSID clsid; BOOL cached; HRESULT hr; @@ -11119,6 +11124,18 @@ static void test_effect_properties(BOOL d3d11) ok(!wcscmp(buffer, L"IsReadOnly"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
ID2D1Properties_Release(subproperties); + + /* Vector2 property */ + index = ID2D1Effect_GetPropertyIndex(effect, L"Vec2Prop"); + hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(buffer, L"Vec2Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer)); + prop_type = ID2D1Effect_GetType(effect, index); + ok(prop_type == D2D1_PROPERTY_TYPE_VECTOR2, "Unexpected type %u.\n", prop_type); + hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_VECTOR2, (BYTE *)vec2, sizeof(vec2)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(vec2[0] == 3.0f && vec2[1] == 4.0f, "Unexpected vector (%.8e,%.8e).\n", vec2[0], vec2[1]); + ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d2d1/effect.c | 1 + dlls/d2d1/tests/d2d1.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index 7cfed6577c4..a2cb08ac873 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -360,6 +360,7 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties * src = &_clsid; break; case D2D1_PROPERTY_TYPE_VECTOR2: + case D2D1_PROPERTY_TYPE_VECTOR3: 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 b7eab5003d7..f76ad185f3e 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -58,6 +58,10 @@ L"<?xml version='1.0'?> \ <Property name='DisplayName' type='string' value='Vec2 prop'/> \ <Property name='Default' type='vector2' value='(1.0, 2.0)'/> \ </Property> \ + <Property name='Vec3Prop' type='vector3' value='(5.0, 6.0, 7.0)'> \ + <Property name='DisplayName' type='string' value='Vec3 prop'/> \ + <Property name='Default' type='vector3' value='(0.1, 0.2, 0.3)'/> \ + </Property> \ </Effect> \ ";
@@ -11030,10 +11034,10 @@ static void test_effect_properties(BOOL d3d11) 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]; - float vec2[2]; CLSID clsid; BOOL cached; HRESULT hr; @@ -11125,7 +11129,7 @@ static void test_effect_properties(BOOL d3d11)
ID2D1Properties_Release(subproperties);
- /* Vector2 property */ + /* Vector2 property. */ index = ID2D1Effect_GetPropertyIndex(effect, L"Vec2Prop"); hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer)); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); @@ -11136,6 +11140,18 @@ static void test_effect_properties(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(vec2[0] == 3.0f && vec2[1] == 4.0f, "Unexpected vector (%.8e,%.8e).\n", vec2[0], vec2[1]);
+ /* Vector3 property. */ + index = ID2D1Effect_GetPropertyIndex(effect, L"Vec3Prop"); + hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(buffer, L"Vec3Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer)); + prop_type = ID2D1Effect_GetType(effect, index); + ok(prop_type == D2D1_PROPERTY_TYPE_VECTOR3, "Unexpected type %u.\n", prop_type); + hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_VECTOR3, (BYTE *)vec3, sizeof(vec3)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + 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]); + ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=118081
Your paranoid android.
=== debian11 (32 bit Chinese:China report) ===
Report validation errors: d2d1:d2d1 prints too much data (38637 bytes)
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@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);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=118082
Your paranoid android.
=== debian11 (32 bit Chinese:China report) ===
Report validation errors: d2d1:d2d1 prints too much data (38637 bytes)
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@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));
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=118083
Your paranoid android.
=== debian11 (32 bit Chinese:China report) ===
Report validation errors: d2d1:d2d1 prints too much data (38680 bytes)
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d2d1/effect.c | 37 ++++++++++++++++----- dlls/d2d1/tests/d2d1.c | 74 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 9 deletions(-)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index 2a980dd33a6..640aab15817 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -230,20 +230,34 @@ static const struct d2d_effect_info builtin_effects[] = };
/* Same syntax is used for value and default values. */ -static HRESULT d2d_effect_parse_vector_value(D2D1_PROPERTY_TYPE type, const WCHAR *value, +static HRESULT d2d_effect_parse_float_array(D2D1_PROPERTY_TYPE type, const WCHAR *value, float *vec) { unsigned int i, num_components; WCHAR *end_ptr;
- assert(type == D2D1_PROPERTY_TYPE_VECTOR2 || type == D2D1_PROPERTY_TYPE_VECTOR3 - || type == D2D1_PROPERTY_TYPE_VECTOR4); + /* Type values are sequential. */ + switch (type) + { + case D2D1_PROPERTY_TYPE_VECTOR2: + case D2D1_PROPERTY_TYPE_VECTOR3: + case D2D1_PROPERTY_TYPE_VECTOR4: + num_components = (type - D2D1_PROPERTY_TYPE_VECTOR2) + 2; + break; + case D2D1_PROPERTY_TYPE_MATRIX_3X2: + num_components = 6; + break; + case D2D1_PROPERTY_TYPE_MATRIX_4X3: + case D2D1_PROPERTY_TYPE_MATRIX_4X4: + case D2D1_PROPERTY_TYPE_MATRIX_5X4: + num_components = (type - D2D1_PROPERTY_TYPE_MATRIX_4X3) * 4 + 12; + break; + default: + return E_UNEXPECTED; + }
if (*(value++) != '(') return E_INVALIDARG;
- /* Type values are sequential. */ - num_components = (type - D2D1_PROPERTY_TYPE_VECTOR2) + 2; - for (i = 0; i < num_components; ++i) { vec[i] = wcstof(value, &end_ptr); @@ -332,7 +346,7 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties * { void *src = NULL; UINT32 _uint32; - float _vec[4]; + float _vec[20]; CLSID _clsid; BOOL _bool;
@@ -363,9 +377,14 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties * 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))) + case D2D1_PROPERTY_TYPE_MATRIX_3X2: + case D2D1_PROPERTY_TYPE_MATRIX_4X3: + case D2D1_PROPERTY_TYPE_MATRIX_4X4: + case D2D1_PROPERTY_TYPE_MATRIX_5X4: + if (FAILED(hr = d2d_effect_parse_float_array(p->type, value, _vec))) { - WARN("Failed to parse vector value %s.\n", wine_dbgstr_w(value)); + WARN("Failed to parse float array %s for type %u.\n", + wine_dbgstr_w(value), p->type); return hr; } src = _vec; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index aa2e98aa22a..334e9f1adea 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -74,6 +74,30 @@ L"<?xml version='1.0'?> \ <Property name='DisplayName' type='string' value='Vec4 prop'/> \ <Property name='Default' type='vector4' value='(0.8,0.9,1.0,1.1)'/> \ </Property> \ + <Property name='Mat3x2Prop' type='matrix3x2' \ + value='(1.0,2.0,3.0,4.0,5.0,6.0)'> \ + <Property name='DisplayName' type='string' value='Mat3x2 prop'/> \ + <Property name='Default' type='matrix3x2' \ + value='(0.1,0.2,0.3,0.4,0.5,0.6)'/> \ + </Property> \ + <Property name='Mat4x3Prop' type='matrix4x3' \ + value='(1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12)'> \ + <Property name='DisplayName' type='string' value='Mat4x3 prop'/> \ + <Property name='Default' type='matrix4x3' \ + value='(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2)'/> \ + </Property> \ + <Property name='Mat4x4Prop' type='matrix4x4' \ + value='(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)'> \ + <Property name='DisplayName' type='string' value='Mat4x4 prop'/> \ + <Property name='Default' type='matrix4x4' \ + value='(16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1)'/> \ + </Property> \ + <Property name='Mat5x4Prop' type='matrix5x4' \ + value='(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)'> \ + <Property name='DisplayName' type='string' value='Mat5x4 prop'/> \ + <Property name='Default' type='matrix5x4' \ + value='(20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1)'/>\ + </Property> \ </Effect> \ ";
@@ -11050,6 +11074,7 @@ static void test_effect_properties(BOOL d3d11) ID2D1Effect *effect; UINT32 count, data; WCHAR buffer[128]; + float mat[20]; INT32 _int32; CLSID clsid; BOOL cached; @@ -11199,6 +11224,55 @@ static void test_effect_properties(BOOL d3d11) 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]);
+ /* Matrix3x2 property. */ + index = ID2D1Effect_GetPropertyIndex(effect, L"Mat3x2Prop"); + hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(buffer, L"Mat3x2Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer)); + prop_type = ID2D1Effect_GetType(effect, index); + ok(prop_type == D2D1_PROPERTY_TYPE_MATRIX_3X2, "Unexpected type %u.\n", prop_type); + hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_MATRIX_3X2, (BYTE *)mat, 6 * sizeof(float)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(mat[0] == 1.0f && mat[1] == 2.0f && mat[2] == 3.0f && mat[3] == 4.0f && mat[4] == 5.0f && mat[5] == 6.0f, + "Unexpected matrix (%.8e,%.8e,%.8e,%.8e,%.8e,%.8e).\n", + mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]); + + /* Matrix4x3 property. */ + index = ID2D1Effect_GetPropertyIndex(effect, L"Mat4x3Prop"); + hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(buffer, L"Mat4x3Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer)); + prop_type = ID2D1Effect_GetType(effect, index); + ok(prop_type == D2D1_PROPERTY_TYPE_MATRIX_4X3, "Unexpected type %u.\n", prop_type); + hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_MATRIX_4X3, (BYTE *)mat, 12 * sizeof(float)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + for (i = 0; i < 12; ++i) + ok(mat[i] == 1.0f + i, "Unexpected matrix element %u.\n", i); + + /* Matrix4x4 property. */ + index = ID2D1Effect_GetPropertyIndex(effect, L"Mat4x4Prop"); + hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(buffer, L"Mat4x4Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer)); + prop_type = ID2D1Effect_GetType(effect, index); + ok(prop_type == D2D1_PROPERTY_TYPE_MATRIX_4X4, "Unexpected type %u.\n", prop_type); + hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_MATRIX_4X4, (BYTE *)mat, 16 * sizeof(float)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + for (i = 0; i < 16; ++i) + ok(mat[i] == 1.0f + i, "Unexpected matrix element %u.\n", i); + + /* Matrix5x4 property. */ + index = ID2D1Effect_GetPropertyIndex(effect, L"Mat5x4Prop"); + hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(buffer, L"Mat5x4Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer)); + prop_type = ID2D1Effect_GetType(effect, index); + ok(prop_type == D2D1_PROPERTY_TYPE_MATRIX_5X4, "Unexpected type %u.\n", prop_type); + hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_MATRIX_5X4, (BYTE *)mat, 20 * sizeof(float)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + for (i = 0; i < 20; ++i) + ok(mat[i] == 1.0f + i, "Unexpected matrix element %u.\n", i); + ID2D1Effect_Release(effect);
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);