Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
5e714c64
Commit
5e714c64
authored
Jul 02, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1/effect: Support parsing matrix poperty values.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
5f1f52cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
9 deletions
+102
-9
effect.c
dlls/d2d1/effect.c
+28
-9
d2d1.c
dlls/d2d1/tests/d2d1.c
+74
-0
No files found.
dlls/d2d1/effect.c
View file @
5e714c64
...
...
@@ -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
;
...
...
dlls/d2d1/tests/d2d1.c
View file @
5e714c64
...
...
@@ -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
.
0
f
&&
vec4
[
1
]
==
9
.
0
f
&&
vec4
[
2
]
==
10
.
0
f
&&
vec4
[
3
]
==
11
.
0
f
,
"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
.
0
f
&&
mat
[
1
]
==
2
.
0
f
&&
mat
[
2
]
==
3
.
0
f
&&
mat
[
3
]
==
4
.
0
f
&&
mat
[
4
]
==
5
.
0
f
&&
mat
[
5
]
==
6
.
0
f
,
"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
.
0
f
+
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
.
0
f
+
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
.
0
f
+
i
,
"Unexpected matrix element %u.
\n
"
,
i
);
ID2D1Effect_Release
(
effect
);
hr
=
ID2D1Factory1_UnregisterEffect
(
factory
,
&
CLSID_TestEffect
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment