Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
7b15245d
Commit
7b15245d
authored
Jun 30, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1/effect: Initial implementation of subproperties.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
ee0fd30e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
2 deletions
+114
-2
d2d1_private.h
dlls/d2d1/d2d1_private.h
+8
-0
effect.c
dlls/d2d1/effect.c
+0
-0
factory.c
dlls/d2d1/factory.c
+50
-1
d2d1.c
dlls/d2d1/tests/d2d1.c
+56
-1
No files found.
dlls/d2d1/d2d1_private.h
View file @
7b15245d
...
@@ -617,10 +617,14 @@ struct d2d_effect_property
...
@@ -617,10 +617,14 @@ struct d2d_effect_property
UINT32
size
;
UINT32
size
;
PD2D1_PROPERTY_SET_FUNCTION
set_function
;
PD2D1_PROPERTY_SET_FUNCTION
set_function
;
PD2D1_PROPERTY_GET_FUNCTION
get_function
;
PD2D1_PROPERTY_GET_FUNCTION
get_function
;
struct
d2d_effect_properties
*
subproperties
;
};
};
struct
d2d_effect_properties
struct
d2d_effect_properties
{
{
ID2D1Properties
ID2D1Properties_iface
;
struct
d2d_effect
*
effect
;
struct
d2d_effect_property
*
properties
;
struct
d2d_effect_property
*
properties
;
size_t
offset
;
size_t
offset
;
size_t
size
;
size_t
size
;
...
@@ -673,6 +677,10 @@ HRESULT d2d_effect_create(struct d2d_device_context *context, const CLSID *effec
...
@@ -673,6 +677,10 @@ HRESULT d2d_effect_create(struct d2d_device_context *context, const CLSID *effec
ID2D1Effect
**
effect
)
DECLSPEC_HIDDEN
;
ID2D1Effect
**
effect
)
DECLSPEC_HIDDEN
;
HRESULT
d2d_effect_properties_add
(
struct
d2d_effect_properties
*
props
,
const
WCHAR
*
name
,
HRESULT
d2d_effect_properties_add
(
struct
d2d_effect_properties
*
props
,
const
WCHAR
*
name
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
const
WCHAR
*
value
)
DECLSPEC_HIDDEN
;
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
const
WCHAR
*
value
)
DECLSPEC_HIDDEN
;
HRESULT
d2d_effect_subproperties_add
(
struct
d2d_effect_properties
*
props
,
const
WCHAR
*
name
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
const
WCHAR
*
value
)
DECLSPEC_HIDDEN
;
struct
d2d_effect_property
*
d2d_effect_properties_get_property_by_name
(
const
struct
d2d_effect_properties
*
properties
,
const
WCHAR
*
name
)
DECLSPEC_HIDDEN
;
void
d2d_effect_properties_cleanup
(
struct
d2d_effect_properties
*
props
)
DECLSPEC_HIDDEN
;
void
d2d_effect_properties_cleanup
(
struct
d2d_effect_properties
*
props
)
DECLSPEC_HIDDEN
;
static
inline
BOOL
d2d_array_reserve
(
void
**
elements
,
size_t
*
capacity
,
size_t
count
,
size_t
size
)
static
inline
BOOL
d2d_array_reserve
(
void
**
elements
,
size_t
*
capacity
,
size_t
count
,
size_t
size
)
...
...
dlls/d2d1/effect.c
View file @
7b15245d
This diff is collapsed.
Click to expand it.
dlls/d2d1/factory.c
View file @
7b15245d
...
@@ -782,6 +782,55 @@ static HRESULT parse_effect_property(IXmlReader *reader, struct d2d_effect_regis
...
@@ -782,6 +782,55 @@ static HRESULT parse_effect_property(IXmlReader *reader, struct d2d_effect_regis
return
hr
;
return
hr
;
}
}
static
HRESULT
parse_effect_inputs
(
IXmlReader
*
reader
,
struct
d2d_effect_registration
*
effect
)
{
struct
d2d_effect_properties
*
subproperties
;
unsigned
int
depth
,
input_count
=
0
;
struct
d2d_effect_property
*
inputs
;
XmlNodeType
node_type
;
WCHAR
nameW
[
16
];
WCHAR
*
name
;
HRESULT
hr
;
if
(
FAILED
(
hr
=
d2d_effect_properties_add
(
&
effect
->
properties
,
L"Inputs"
,
D2D1_PROPERTY_INPUTS
,
D2D1_PROPERTY_TYPE_ARRAY
,
NULL
)))
return
hr
;
if
(
!
(
inputs
=
d2d_effect_properties_get_property_by_name
(
&
effect
->
properties
,
L"Inputs"
)))
return
E_FAIL
;
if
(
!
(
inputs
->
subproperties
=
calloc
(
1
,
sizeof
(
*
inputs
->
subproperties
))))
return
E_OUTOFMEMORY
;
subproperties
=
inputs
->
subproperties
;
d2d_effect_subproperties_add
(
subproperties
,
L"IsReadOnly"
,
D2D1_SUBPROPERTY_ISREADONLY
,
D2D1_PROPERTY_TYPE_BOOL
,
L"true"
);
d2d_effect_subproperties_add
(
subproperties
,
L"DisplayName"
,
D2D1_SUBPROPERTY_DISPLAYNAME
,
D2D1_PROPERTY_TYPE_STRING
,
L"Inputs"
);
if
(
IXmlReader_IsEmptyElement
(
reader
))
return
S_OK
;
while
(
parse_effect_get_next_xml_node
(
reader
,
XmlNodeType_None
,
L"Input"
,
&
depth
)
==
S_OK
)
{
if
(
FAILED
(
hr
=
IXmlReader_GetNodeType
(
reader
,
&
node_type
)))
return
hr
;
if
(
node_type
==
XmlNodeType_EndElement
)
continue
;
if
(
node_type
!=
XmlNodeType_Element
)
return
HRESULT_FROM_WIN32
(
ERROR_NOT_FOUND
);
if
(
FAILED
(
hr
=
parse_effect_get_attribute
(
reader
,
L"name"
,
&
name
)))
return
hr
;
swprintf
(
nameW
,
ARRAY_SIZE
(
nameW
),
L"%lu"
,
input_count
);
d2d_effect_subproperties_add
(
subproperties
,
nameW
,
input_count
,
D2D1_PROPERTY_TYPE_STRING
,
name
);
input_count
++
;
free
(
name
);
}
*
(
UINT32
*
)(
effect
->
properties
.
data
.
ptr
+
inputs
->
data
.
offset
)
=
input_count
;
if
(
FAILED
(
hr
=
IXmlReader_GetNodeType
(
reader
,
&
node_type
)))
return
hr
;
if
(
node_type
!=
XmlNodeType_EndElement
)
return
HRESULT_FROM_WIN32
(
ERROR_NOT_FOUND
);
return
S_OK
;
}
static
HRESULT
parse_effect_xml
(
IXmlReader
*
reader
,
struct
d2d_effect_registration
*
effect
)
static
HRESULT
parse_effect_xml
(
IXmlReader
*
reader
,
struct
d2d_effect_registration
*
effect
)
{
{
const
WCHAR
*
node_name
;
const
WCHAR
*
node_name
;
...
@@ -808,7 +857,7 @@ static HRESULT parse_effect_xml(IXmlReader *reader, struct d2d_effect_registrati
...
@@ -808,7 +857,7 @@ static HRESULT parse_effect_xml(IXmlReader *reader, struct d2d_effect_registrati
if
(
!
wcscmp
(
node_name
,
L"Property"
))
if
(
!
wcscmp
(
node_name
,
L"Property"
))
hr
=
parse_effect_property
(
reader
,
effect
);
hr
=
parse_effect_property
(
reader
,
effect
);
else
if
(
!
wcscmp
(
node_name
,
L"Inputs"
))
else
if
(
!
wcscmp
(
node_name
,
L"Inputs"
))
hr
=
parse_effect_
skip_element
(
reader
,
depth
);
hr
=
parse_effect_
inputs
(
reader
,
effect
);
else
else
{
{
WARN
(
"Unexpected element %s.
\n
"
,
debugstr_w
(
node_name
));
WARN
(
"Unexpected element %s.
\n
"
,
debugstr_w
(
node_name
));
...
...
dlls/d2d1/tests/d2d1.c
View file @
7b15245d
...
@@ -10934,12 +10934,15 @@ static void test_effect_context(BOOL d3d11)
...
@@ -10934,12 +10934,15 @@ static void test_effect_context(BOOL d3d11)
static
void
test_effect_properties
(
BOOL
d3d11
)
static
void
test_effect_properties
(
BOOL
d3d11
)
{
{
UINT32
i
,
min_inputs
,
max_inputs
,
integer
,
index
;
UINT32
i
,
min_inputs
,
max_inputs
,
integer
,
index
,
size
;
ID2D1EffectContext
*
effect_context
;
ID2D1EffectContext
*
effect_context
;
D2D1_BUFFER_PRECISION
precision
;
D2D1_BUFFER_PRECISION
precision
;
ID2D1Properties
*
subproperties
;
D2D1_PROPERTY_TYPE
prop_type
;
struct
d2d1_test_context
ctx
;
struct
d2d1_test_context
ctx
;
ID2D1Factory1
*
factory
;
ID2D1Factory1
*
factory
;
ID2D1Effect
*
effect
;
ID2D1Effect
*
effect
;
UINT32
count
,
data
;
WCHAR
buffer
[
128
];
WCHAR
buffer
[
128
];
CLSID
clsid
;
CLSID
clsid
;
BOOL
cached
;
BOOL
cached
;
...
@@ -10984,6 +10987,58 @@ static void test_effect_properties(BOOL d3d11)
...
@@ -10984,6 +10987,58 @@ static void test_effect_properties(BOOL d3d11)
return
;
return
;
}
}
/* Inputs array */
hr
=
ID2D1Factory1_RegisterEffectFromString
(
factory
,
&
CLSID_TestEffect
,
effect_xml_a
,
NULL
,
0
,
effect_impl_create
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1DeviceContext_CreateEffect
(
ctx
.
context
,
&
CLSID_TestEffect
,
&
effect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
size
=
ID2D1Effect_GetValueSize
(
effect
,
D2D1_PROPERTY_INPUTS
);
ok
(
size
==
4
,
"Unexpected size %u.
\n
"
,
size
);
prop_type
=
ID2D1Effect_GetType
(
effect
,
D2D1_PROPERTY_INPUTS
);
ok
(
prop_type
==
D2D1_PROPERTY_TYPE_ARRAY
,
"Unexpected type %u.
\n
"
,
prop_type
);
hr
=
ID2D1Effect_GetPropertyName
(
effect
,
D2D1_PROPERTY_INPUTS
,
buffer
,
ARRAY_SIZE
(
buffer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
buffer
,
L"Inputs"
),
"Unexpected name %s.
\n
"
,
wine_dbgstr_w
(
buffer
));
/* Value is the number of elements. */
data
=
123
;
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_INPUTS
,
D2D1_PROPERTY_TYPE_ARRAY
,
(
BYTE
*
)
&
data
,
sizeof
(
data
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
data
==
1
,
"Unexpected data %u.
\n
"
,
data
);
hr
=
ID2D1Effect_GetSubProperties
(
effect
,
D2D1_PROPERTY_INPUTS
,
&
subproperties
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
count
=
ID2D1Properties_GetPropertyCount
(
subproperties
);
ok
(
count
==
1
,
"Unexpected count %u.
\n
"
,
count
);
hr
=
ID2D1Properties_GetPropertyName
(
subproperties
,
0
,
buffer
,
ARRAY_SIZE
(
buffer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
buffer
,
L"0"
),
"Unexpected name %s.
\n
"
,
wine_dbgstr_w
(
buffer
));
hr
=
ID2D1Properties_GetValue
(
subproperties
,
0
,
D2D1_PROPERTY_TYPE_STRING
,
(
BYTE
*
)
buffer
,
sizeof
(
buffer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
buffer
,
L"Source"
),
"Unexpected value %s.
\n
"
,
wine_dbgstr_w
(
buffer
));
hr
=
ID2D1Properties_GetValue
(
subproperties
,
D2D1_SUBPROPERTY_ISREADONLY
,
D2D1_PROPERTY_TYPE_BOOL
,
(
BYTE
*
)
&
data
,
sizeof
(
data
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
data
==
TRUE
,
"Unexpected value %u.
\n
"
,
data
);
hr
=
ID2D1Properties_GetPropertyName
(
subproperties
,
D2D1_SUBPROPERTY_ISREADONLY
,
buffer
,
ARRAY_SIZE
(
buffer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
buffer
,
L"IsReadOnly"
),
"Unexpected name %s.
\n
"
,
wine_dbgstr_w
(
buffer
));
ID2D1Properties_Release
(
subproperties
);
ID2D1Effect_Release
(
effect
);
hr
=
ID2D1Factory1_UnregisterEffect
(
factory
,
&
CLSID_TestEffect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
/* Test system properties */
/* Test system properties */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
system_property_tests
);
++
i
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
system_property_tests
);
++
i
)
...
...
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