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
16710311
Commit
16710311
authored
Jan 03, 2024
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1/effect: Use XML description for builtin effects.
parent
9b32b18b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
240 additions
and
90 deletions
+240
-90
d2d1_private.h
dlls/d2d1/d2d1_private.h
+3
-2
effect.c
dlls/d2d1/effect.c
+126
-50
factory.c
dlls/d2d1/factory.c
+54
-22
d2d1.c
dlls/d2d1/tests/d2d1.c
+57
-16
No files found.
dlls/d2d1/d2d1_private.h
View file @
16710311
...
...
@@ -674,8 +674,6 @@ struct d2d_effect_registration
BOOL
builtin
;
CLSID
id
;
UINT32
input_count
;
UINT32
default_input_count
;
struct
d2d_effect_properties
properties
;
};
...
...
@@ -740,6 +738,9 @@ HRESULT d2d_effect_subproperties_add(struct d2d_effect_properties *props, const
struct
d2d_effect_property
*
d2d_effect_properties_get_property_by_name
(
const
struct
d2d_effect_properties
*
properties
,
const
WCHAR
*
name
);
void
d2d_effect_properties_cleanup
(
struct
d2d_effect_properties
*
props
);
HRESULT
d2d_factory_register_builtin_effect
(
struct
d2d_factory
*
factory
,
REFCLSID
effect_id
,
const
WCHAR
*
property_xml
,
const
D2D1_PROPERTY_BINDING
*
bindings
,
UINT32
binding_count
,
PD2D1_EFFECT_FACTORY
effect_factory
);
enum
d2d_command_list_state
{
...
...
dlls/d2d1/effect.c
View file @
16710311
...
...
@@ -211,48 +211,105 @@ static HRESULT STDMETHODCALLTYPE builtin_factory_stub(IUnknown **effect_impl)
return
S_OK
;
}
struct
d2d_effect_info
{
const
CLSID
*
clsid
;
UINT32
default_input_count
;
UINT32
min_inputs
;
UINT32
max_inputs
;
};
static
const
struct
d2d_effect_info
builtin_effects
[]
=
{
{
&
CLSID_D2D12DAffineTransform
,
1
,
1
,
1
},
{
&
CLSID_D2D13DPerspectiveTransform
,
1
,
1
,
1
},
{
&
CLSID_D2D1Composite
,
2
,
1
,
0xffffffff
},
{
&
CLSID_D2D1Crop
,
1
,
1
,
1
},
{
&
CLSID_D2D1Shadow
,
1
,
1
,
1
},
{
&
CLSID_D2D1Grayscale
,
1
,
1
,
1
},
};
static
const
WCHAR
*
const
_2d_affine_transform_description
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='2D Affine Transform'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Stub'/> \
<Property name='Description' type='string' value='2D Affine Transform'/> \
<Inputs> \
<Input name='Source'/> \
</Inputs> \
</Effect>"
;
static
const
WCHAR
*
const
_3d_perspective_transform_description
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='3D Perspective Transform'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Stub'/> \
<Property name='Description' type='string' value='3D Perspective Transform'/> \
<Inputs> \
<Input name='Source'/> \
</Inputs> \
</Effect>"
;
static
const
WCHAR
*
const
composite_description
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='Composite'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Stub'/> \
<Property name='Description' type='string' value='Composite'/> \
<Inputs minimum='1' maximum='0xffffffff' > \
<Input name='Source1'/> \
<Input name='Source2'/> \
</Inputs> \
</Effect>"
;
static
const
WCHAR
*
const
crop_description
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='Crop'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Stub'/> \
<Property name='Description' type='string' value='Crop'/> \
<Inputs > \
<Input name='Source'/> \
</Inputs> \
</Effect>"
;
static
const
WCHAR
*
const
shadow_description
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='Shadow'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Stub'/> \
<Property name='Description' type='string' value='Shadow'/> \
<Inputs > \
<Input name='Source'/> \
</Inputs> \
</Effect>"
;
static
const
WCHAR
*
const
grayscale_description
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='Grayscale'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Stub'/> \
<Property name='Description' type='string' value='Grayscale'/> \
<Inputs > \
<Input name='Source'/> \
</Inputs> \
</Effect>"
;
void
d2d_effects_init_builtins
(
struct
d2d_factory
*
factory
)
{
struct
d2d_effect_registration
*
effect
;
static
const
struct
builtin_description
{
const
CLSID
*
clsid
;
const
WCHAR
*
description
;
}
builtin_effects
[]
=
{
{
&
CLSID_D2D12DAffineTransform
,
_2d_affine_transform_description
},
{
&
CLSID_D2D13DPerspectiveTransform
,
_3d_perspective_transform_description
},
{
&
CLSID_D2D1Composite
,
composite_description
},
{
&
CLSID_D2D1Crop
,
crop_description
},
{
&
CLSID_D2D1Shadow
,
shadow_description
},
{
&
CLSID_D2D1Grayscale
,
grayscale_description
},
};
unsigned
int
i
;
HRESULT
hr
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
builtin_effects
);
++
i
)
{
const
struct
d2d_effect_info
*
info
=
&
builtin_effects
[
i
];
WCHAR
max_inputs
[
32
];
if
(
!
(
effect
=
calloc
(
1
,
sizeof
(
*
effect
))))
return
;
swprintf
(
max_inputs
,
ARRAY_SIZE
(
max_inputs
),
L"%lu"
,
info
->
max_inputs
);
d2d_effect_properties_add
(
&
effect
->
properties
,
L"MinInputs"
,
D2D1_PROPERTY_MIN_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
L"1"
);
d2d_effect_properties_add
(
&
effect
->
properties
,
L"MaxInputs"
,
D2D1_PROPERTY_MAX_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
max_inputs
);
memcpy
(
&
effect
->
id
,
info
->
clsid
,
sizeof
(
*
info
->
clsid
));
effect
->
default_input_count
=
info
->
default_input_count
;
effect
->
factory
=
builtin_factory_stub
;
effect
->
builtin
=
TRUE
;
d2d_factory_register_effect
(
factory
,
effect
);
if
(
FAILED
(
hr
=
d2d_factory_register_builtin_effect
(
factory
,
builtin_effects
[
i
].
clsid
,
builtin_effects
[
i
].
description
,
NULL
,
0
,
builtin_factory_stub
)))
{
WARN
(
"Failed to register the effect %s, hr %#lx.
\n
"
,
wine_dbgstr_guid
(
builtin_effects
[
i
].
clsid
),
hr
);
}
}
}
...
...
@@ -387,6 +444,9 @@ static HRESULT d2d_effect_properties_internal_add(struct d2d_effect_properties *
{
case
D2D1_PROPERTY_TYPE_UINT32
:
case
D2D1_PROPERTY_TYPE_INT32
:
_uint32
=
wcstoul
(
value
,
NULL
,
0
);
src
=
&
_uint32
;
break
;
case
D2D1_PROPERTY_TYPE_ENUM
:
_uint32
=
wcstoul
(
value
,
NULL
,
10
);
src
=
&
_uint32
;
...
...
@@ -1127,6 +1187,12 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_GetValueByName(ID2D1Effect *iface, c
value
,
value_size
);
}
static
HRESULT
d2d_effect_get_value
(
struct
d2d_effect
*
effect
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
BYTE
*
value
,
UINT32
value_size
)
{
return
ID2D1Properties_GetValue
(
&
effect
->
properties
.
ID2D1Properties_iface
,
index
,
type
,
value
,
value_size
);
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetValue
(
ID2D1Effect
*
iface
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
BYTE
*
value
,
UINT32
value_size
)
{
...
...
@@ -1134,8 +1200,7 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_GetValue(ID2D1Effect *iface, UINT32
TRACE
(
"iface %p, index %#x, type %u, value %p, value_size %u.
\n
"
,
iface
,
index
,
type
,
value
,
value_size
);
return
ID2D1Properties_GetValue
(
&
effect
->
properties
.
ID2D1Properties_iface
,
index
,
type
,
value
,
value_size
);
return
d2d_effect_get_value
(
effect
,
index
,
type
,
value
,
value_size
);
}
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetValueSize
(
ID2D1Effect
*
iface
,
UINT32
index
)
...
...
@@ -1172,20 +1237,10 @@ static void STDMETHODCALLTYPE d2d_effect_SetInput(ID2D1Effect *iface, UINT32 ind
effect
->
inputs
[
index
]
=
input
;
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_SetInputCount
(
ID2D1Effect
*
iface
,
UINT32
count
)
static
HRESULT
d2d_effect_set_input_count
(
struct
d2d_effect
*
effect
,
UINT32
count
)
{
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
unsigned
int
i
,
min_inputs
,
max_inputs
;
TRACE
(
"iface %p, count %u.
\n
"
,
iface
,
count
);
d2d_effect_GetValue
(
iface
,
D2D1_PROPERTY_MIN_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
min_inputs
,
sizeof
(
min_inputs
));
d2d_effect_GetValue
(
iface
,
D2D1_PROPERTY_MAX_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
max_inputs
,
sizeof
(
max_inputs
));
unsigned
int
i
;
if
(
count
<
min_inputs
||
count
>
max_inputs
)
return
E_INVALIDARG
;
if
(
count
==
effect
->
input_count
)
return
S_OK
;
...
...
@@ -1213,6 +1268,24 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_SetInputCount(ID2D1Effect *iface, UI
return
S_OK
;
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_SetInputCount
(
ID2D1Effect
*
iface
,
UINT32
count
)
{
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
unsigned
int
min_inputs
,
max_inputs
;
TRACE
(
"iface %p, count %u.
\n
"
,
iface
,
count
);
d2d_effect_get_value
(
effect
,
D2D1_PROPERTY_MIN_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
min_inputs
,
sizeof
(
min_inputs
));
d2d_effect_get_value
(
effect
,
D2D1_PROPERTY_MAX_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
max_inputs
,
sizeof
(
max_inputs
));
if
(
count
<
min_inputs
||
count
>
max_inputs
)
return
E_INVALIDARG
;
return
d2d_effect_set_input_count
(
effect
,
count
);
}
static
void
STDMETHODCALLTYPE
d2d_effect_GetInput
(
ID2D1Effect
*
iface
,
UINT32
index
,
ID2D1Image
**
input
)
{
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
...
...
@@ -1539,6 +1612,7 @@ HRESULT d2d_effect_create(struct d2d_device_context *context, const CLSID *effec
const
struct
d2d_effect_registration
*
reg
;
struct
d2d_transform_graph
*
graph
;
struct
d2d_effect
*
object
;
UINT32
input_count
;
WCHAR
clsidW
[
39
];
HRESULT
hr
;
...
...
@@ -1581,7 +1655,9 @@ HRESULT d2d_effect_create(struct d2d_device_context *context, const CLSID *effec
d2d_effect_properties_add
(
&
object
->
properties
,
L"Precision"
,
D2D1_PROPERTY_PRECISION
,
D2D1_PROPERTY_TYPE_ENUM
,
L"0"
);
d2d_effect_init_properties_vtbls
(
object
);
d2d_effect_SetInputCount
(
&
object
->
ID2D1Effect_iface
,
reg
->
default_input_count
);
/* Sync instance input count with default input count from the description. */
d2d_effect_get_value
(
object
,
D2D1_PROPERTY_INPUTS
,
D2D1_PROPERTY_TYPE_ARRAY
,
(
BYTE
*
)
&
input_count
,
sizeof
(
input_count
));
d2d_effect_set_input_count
(
object
,
input_count
);
if
(
FAILED
(
hr
=
reg
->
factory
((
IUnknown
**
)
&
object
->
impl
)))
{
...
...
dlls/d2d1/factory.c
View file @
16710311
...
...
@@ -69,7 +69,7 @@ struct d2d_effect_registration * d2d_factory_get_registered_effect(ID2D1Factory
struct
d2d_factory
*
factory
=
unsafe_impl_from_ID2D1Factory
(
iface
);
struct
d2d_effect_registration
*
reg
;
d2d_
effects_init_builtin
s
(
factory
);
d2d_
factory_init_builtin_effect
s
(
factory
);
LIST_FOR_EACH_ENTRY
(
reg
,
&
factory
->
effects
,
struct
d2d_effect_registration
,
entry
)
{
...
...
@@ -880,7 +880,7 @@ static HRESULT parse_effect_inputs(IXmlReader *reader, struct d2d_effect_registr
return
E_INVALIDARG
;
}
/* Apply default value to a missing property. */
/* Apply default value to a missing property.
If both properties are missing, add them.
*/
if
(
min_inputs
!=
max_inputs
)
{
swprintf
(
buffW
,
ARRAY_SIZE
(
buffW
),
L"%lu"
,
min_inputs
?
min_inputs_value
:
max_inputs_value
);
...
...
@@ -889,6 +889,13 @@ static HRESULT parse_effect_inputs(IXmlReader *reader, struct d2d_effect_registr
else
hr
=
d2d_effect_properties_add
(
&
effect
->
properties
,
L"MinInputs"
,
D2D1_PROPERTY_MIN_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
buffW
);
}
else
if
(
!
min_inputs
)
{
swprintf
(
buffW
,
ARRAY_SIZE
(
buffW
),
L"%lu"
,
input_count
);
hr
=
d2d_effect_properties_add
(
&
effect
->
properties
,
L"MinInputs"
,
D2D1_PROPERTY_MIN_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
buffW
);
if
(
SUCCEEDED
(
hr
))
hr
=
d2d_effect_properties_add
(
&
effect
->
properties
,
L"MaxInputs"
,
D2D1_PROPERTY_MAX_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
buffW
);
}
return
hr
;
}
...
...
@@ -933,21 +940,15 @@ static HRESULT parse_effect_xml(IXmlReader *reader, struct d2d_effect_registrati
return
hr
;
}
static
HRESULT
STDMETHODCALLTYPE
d2d_factory_RegisterEffectFromStream
(
ID2D1Factory3
*
iface
,
static
HRESULT
d2d_factory_register_effect_from_stream
(
struct
d2d_factory
*
factory
,
REFCLSID
effect_id
,
IStream
*
property_xml
,
const
D2D1_PROPERTY_BINDING
*
bindings
,
UINT32
binding_count
,
PD2D1_EFFECT_FACTORY
effect_factory
)
UINT32
binding_count
,
PD2D1_EFFECT_FACTORY
effect_factory
,
BOOL
builtin
)
{
struct
d2d_factory
*
factory
=
impl_from_ID2D1Factory3
(
iface
);
struct
d2d_effect_registration
*
effect
;
IXmlReader
*
reader
;
unsigned
int
i
;
HRESULT
hr
;
TRACE
(
"iface %p, effect_id %s, property_xml %p, bindings %p, binding_count %u, effect_factory %p.
\n
"
,
iface
,
debugstr_guid
(
effect_id
),
property_xml
,
bindings
,
binding_count
,
effect_factory
);
d2d_factory_init_builtin_effects
(
factory
);
LIST_FOR_EACH_ENTRY_REV
(
effect
,
&
factory
->
effects
,
struct
d2d_effect_registration
,
entry
)
{
if
(
IsEqualGUID
(
effect_id
,
&
effect
->
id
))
...
...
@@ -972,6 +973,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_RegisterEffectFromStream(ID2D1Facto
IXmlReader_Release
(
reader
);
return
E_OUTOFMEMORY
;
}
effect
->
builtin
=
builtin
;
hr
=
parse_effect_xml
(
reader
,
effect
);
IXmlReader_Release
(
reader
);
...
...
@@ -1013,28 +1015,35 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_RegisterEffectFromStream(ID2D1Facto
effect
->
registration_count
=
1
;
effect
->
id
=
*
effect_id
;
effect
->
factory
=
effect_factory
;
d2d_effect_properties_add
(
&
effect
->
properties
,
L"MinInputs"
,
D2D1_PROPERTY_MIN_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
L"1"
);
d2d_effect_properties_add
(
&
effect
->
properties
,
L"MaxInputs"
,
D2D1_PROPERTY_MAX_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
L"1"
/* FIXME */
);
effect
->
default_input_count
=
1
;
d2d_factory_register_effect
(
factory
,
effect
);
return
S_OK
;
}
static
HRESULT
STDMETHODCALLTYPE
d2d_factory_RegisterEffectFromStr
ing
(
ID2D1Factory3
*
iface
,
REFCLSID
effect_id
,
const
WCHAR
*
property_xml
,
const
D2D1_PROPERTY_BINDING
*
bindings
,
static
HRESULT
STDMETHODCALLTYPE
d2d_factory_RegisterEffectFromStr
eam
(
ID2D1Factory3
*
iface
,
REFCLSID
effect_id
,
IStream
*
property_xml
,
const
D2D1_PROPERTY_BINDING
*
bindings
,
UINT32
binding_count
,
PD2D1_EFFECT_FACTORY
effect_factory
)
{
struct
d2d_factory
*
factory
=
impl_from_ID2D1Factory3
(
iface
);
TRACE
(
"iface %p, effect_id %s, property_xml %p, bindings %p, binding_count %u, effect_factory %p.
\n
"
,
iface
,
debugstr_guid
(
effect_id
),
property_xml
,
bindings
,
binding_count
,
effect_factory
);
d2d_factory_init_builtin_effects
(
factory
);
return
d2d_factory_register_effect_from_stream
(
factory
,
effect_id
,
property_xml
,
bindings
,
binding_count
,
effect_factory
,
FALSE
);
}
static
HRESULT
d2d_factory_register_effect_from_string
(
struct
d2d_factory
*
factory
,
REFCLSID
effect_id
,
const
WCHAR
*
property_xml
,
const
D2D1_PROPERTY_BINDING
*
bindings
,
UINT32
binding_count
,
PD2D1_EFFECT_FACTORY
effect_factory
,
BOOL
builtin
)
{
static
const
LARGE_INTEGER
zero
;
IStream
*
stream
;
ULONG
size
;
HRESULT
hr
;
TRACE
(
"iface %p, effect_id %s, property_xml %s, bindings %p, binding_count %u, effect_factory %p.
\n
"
,
iface
,
debugstr_guid
(
effect_id
),
debugstr_w
(
property_xml
),
bindings
,
binding_count
,
effect_factory
);
if
(
FAILED
(
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
)))
return
hr
;
...
...
@@ -1043,13 +1052,36 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_RegisterEffectFromString(ID2D1Facto
hr
=
IStream_Seek
(
stream
,
zero
,
SEEK_SET
,
NULL
);
if
(
SUCCEEDED
(
hr
))
hr
=
ID2D1Factory3_RegisterEffectFromStream
(
iface
,
effect_id
,
stream
,
bindings
,
binding_count
,
effect_factory
);
hr
=
d2d_factory_register_effect_from_stream
(
factory
,
effect_id
,
stream
,
bindings
,
binding_count
,
effect_factory
,
builtin
);
IStream_Release
(
stream
);
return
hr
;
}
HRESULT
d2d_factory_register_builtin_effect
(
struct
d2d_factory
*
factory
,
REFCLSID
effect_id
,
const
WCHAR
*
property_xml
,
const
D2D1_PROPERTY_BINDING
*
bindings
,
UINT32
binding_count
,
PD2D1_EFFECT_FACTORY
effect_factory
)
{
return
d2d_factory_register_effect_from_string
(
factory
,
effect_id
,
property_xml
,
bindings
,
binding_count
,
effect_factory
,
TRUE
);
}
static
HRESULT
STDMETHODCALLTYPE
d2d_factory_RegisterEffectFromString
(
ID2D1Factory3
*
iface
,
REFCLSID
effect_id
,
const
WCHAR
*
property_xml
,
const
D2D1_PROPERTY_BINDING
*
bindings
,
UINT32
binding_count
,
PD2D1_EFFECT_FACTORY
effect_factory
)
{
struct
d2d_factory
*
factory
=
impl_from_ID2D1Factory3
(
iface
);
TRACE
(
"iface %p, effect_id %s, property_xml %s, bindings %p, binding_count %u, effect_factory %p.
\n
"
,
iface
,
debugstr_guid
(
effect_id
),
debugstr_w
(
property_xml
),
bindings
,
binding_count
,
effect_factory
);
d2d_factory_init_builtin_effects
(
factory
);
return
d2d_factory_register_effect_from_string
(
factory
,
effect_id
,
property_xml
,
bindings
,
binding_count
,
effect_factory
,
FALSE
);
}
static
HRESULT
STDMETHODCALLTYPE
d2d_factory_UnregisterEffect
(
ID2D1Factory3
*
iface
,
REFCLSID
effect_id
)
{
struct
d2d_factory
*
factory
=
impl_from_ID2D1Factory3
(
iface
);
...
...
dlls/d2d1/tests/d2d1.c
View file @
16710311
...
...
@@ -53,10 +53,22 @@ L"<?xml version='1.0'?> \
<Property name='DisplayName' type='string' value='Int32 prop'/> \
<Property name='Default' type='int32' value='10'/> \
</Property> \
<Property name='Int32PropHex' type='int32' value='0xffff0001'> \
<Property name='DisplayName' type='string' value='Int32 prop hex'/> \
</Property> \
<Property name='Int32PropOct' type='int32' value='012'> \
<Property name='DisplayName' type='string' value='Int32 prop oct'/> \
</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='UInt32PropHex' type='uint32' value='0xfff'> \
<Property name='DisplayName' type='string' value='UInt32 prop hex'/> \
</Property> \
<Property name='UInt32PropOct' type='uint32' value='013'> \
<Property name='DisplayName' type='string' value='UInt32 prop oct'/> \
</Property> \
<Property name='Bool' type='bool'> \
<Property name='DisplayName' type='string' value='Bool property'/> \
<Property name='Default' type='bool' value='false'/> \
...
...
@@ -10820,8 +10832,8 @@ static void test_mt_factory(BOOL d3d11)
release_test_context
(
&
ctx
);
}
#define check_system_properties(effect
, is_builtin) check_system_properties_(__LINE__, effect, is_builtin
)
static
void
check_system_properties_
(
unsigned
int
line
,
ID2D1Effect
*
effect
,
BOOL
is_builtin
)
#define check_system_properties(effect
) check_system_properties_(__LINE__, effect
)
static
void
check_system_properties_
(
unsigned
int
line
,
ID2D1Effect
*
effect
)
{
UINT
i
,
value_size
,
str_size
;
WCHAR
name
[
32
],
buffer
[
256
];
...
...
@@ -10863,7 +10875,6 @@ static void check_system_properties_(unsigned int line, ID2D1Effect *effect, BOO
name
[
0
]
=
0
;
hr
=
ID2D1Effect_GetPropertyName
(
effect
,
test
->
index
,
name
,
sizeof
(
name
));
todo_wine_if
((
is_builtin
&&
(
test
->
type
==
D2D1_PROPERTY_TYPE_ARRAY
||
test
->
type
==
D2D1_PROPERTY_TYPE_STRING
)))
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Failed to get property name, hr %#lx
\n
"
,
hr
);
if
(
hr
==
D2DERR_INVALID_PROPERTY
)
{
...
...
@@ -10874,7 +10885,6 @@ static void check_system_properties_(unsigned int line, ID2D1Effect *effect, BOO
debugstr_w
(
name
),
debugstr_w
(
test
->
name
));
type
=
ID2D1Effect_GetType
(
effect
,
test
->
index
);
todo_wine_if
((
is_builtin
&&
(
test
->
type
==
D2D1_PROPERTY_TYPE_ARRAY
||
test
->
type
==
D2D1_PROPERTY_TYPE_STRING
)))
ok_
(
__FILE__
,
line
)(
type
==
test
->
type
,
"Got unexpected property type %#x, expected %#x.
\n
"
,
type
,
test
->
type
);
...
...
@@ -10882,17 +10892,15 @@ static void check_system_properties_(unsigned int line, ID2D1Effect *effect, BOO
value_size
=
ID2D1Effect_GetValueSize
(
effect
,
test
->
index
);
if
(
test
->
value_size
!=
0
)
{
todo_wine_if
(
is_builtin
&&
test
->
type
==
D2D1_PROPERTY_TYPE_ARRAY
)
ok_
(
__FILE__
,
line
)(
value_size
==
test
->
value_size
,
"Got unexpected value size %u, expected %u.
\n
"
,
value_size
,
test
->
value_size
);
}
else
if
(
test
->
type
==
D2D1_PROPERTY_TYPE_STRING
)
{
hr
=
ID2D1Effect_GetValue
(
effect
,
test
->
index
,
D2D1_PROPERTY_TYPE_STRING
,
(
BYTE
*
)
buffer
,
sizeof
(
buffer
));
todo_wine_if
(
is_builtin
)
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Failed to get value, hr %#lx.
\n
"
,
hr
);
str_size
=
(
wcslen
((
WCHAR
*
)
buffer
)
+
1
)
*
sizeof
(
WCHAR
);
todo_wine_if
(
is_builtin
||
buffer
[
0
]
==
0
)
todo_wine_if
(
buffer
[
0
]
==
0
)
ok_
(
__FILE__
,
line
)(
value_size
==
str_size
,
"Got unexpected value size %u, expected %u.
\n
"
,
value_size
,
str_size
);
}
...
...
@@ -10982,12 +10990,12 @@ static void test_builtin_effect(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_DISPLAYNAME
,
D2D1_PROPERTY_TYPE_STRING
,
buffer
,
sizeof
(
buffer
));
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
str_size
=
(
wcslen
((
WCHAR
*
)
buffer
)
+
1
)
*
sizeof
(
WCHAR
);
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_DISPLAYNAME
,
D2D1_PROPERTY_TYPE_STRING
,
buffer
,
str_size
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_DISPLAYNAME
,
D2D1_PROPERTY_TYPE_STRING
,
buffer
,
str_size
-
1
);
todo_wine
ok
(
hr
==
D2DERR_INSUFFICIENT_BUFFER
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
D2DERR_INSUFFICIENT_BUFFER
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_CLSID
,
0xdeadbeef
,
(
BYTE
*
)
&
clsid
,
sizeof
(
clsid
));
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -11472,6 +11480,8 @@ static void test_effect_register(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1DeviceContext_CreateEffect
(
device_context
,
&
CLSID_TestEffect
,
&
effect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
integer
=
ID2D1Effect_GetInputCount
(
effect
);
ok
(
integer
==
3
,
"Unexpected input count %u.
\n
"
,
integer
);
integer
=
0
;
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_MIN_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
...
...
@@ -11740,6 +11750,28 @@ static void test_effect_properties(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
val
==
-
2
,
"Unexpected value %d.
\n
"
,
val
);
/* Int32 property, hex literal. */
index
=
ID2D1Effect_GetPropertyIndex
(
effect
,
L"Int32PropHex"
);
hr
=
ID2D1Effect_GetPropertyName
(
effect
,
index
,
buffer
,
ARRAY_SIZE
(
buffer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
buffer
,
L"Int32PropHex"
),
"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
*
)
&
val
,
sizeof
(
val
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
val
==
-
65535
,
"Unexpected value %d.
\n
"
,
val
);
/* Int32 property, octal literal. */
index
=
ID2D1Effect_GetPropertyIndex
(
effect
,
L"Int32PropOct"
);
hr
=
ID2D1Effect_GetPropertyName
(
effect
,
index
,
buffer
,
ARRAY_SIZE
(
buffer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
buffer
,
L"Int32PropOct"
),
"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
*
)
&
val
,
sizeof
(
val
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
val
==
10
,
"Unexpected value %d.
\n
"
,
val
);
/* UInt32 property. */
index
=
ID2D1Effect_GetPropertyIndex
(
effect
,
L"UInt32Prop"
);
hr
=
ID2D1Effect_GetPropertyName
(
effect
,
index
,
buffer
,
ARRAY_SIZE
(
buffer
));
...
...
@@ -11751,6 +11783,17 @@ static void test_effect_properties(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
integer
==
-
3
,
"Unexpected value %u.
\n
"
,
integer
);
/* UInt32 property, hex literal. */
index
=
ID2D1Effect_GetPropertyIndex
(
effect
,
L"UInt32PropHex"
);
hr
=
ID2D1Effect_GetPropertyName
(
effect
,
index
,
buffer
,
ARRAY_SIZE
(
buffer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
buffer
,
L"UInt32PropHex"
),
"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
==
0xfff
,
"Unexpected value %x.
\n
"
,
integer
);
/* Vector2 property. */
index
=
ID2D1Effect_GetPropertyIndex
(
effect
,
L"Vec2Prop"
);
hr
=
ID2D1Effect_GetPropertyName
(
effect
,
index
,
buffer
,
ARRAY_SIZE
(
buffer
));
...
...
@@ -11854,7 +11897,7 @@ static void test_effect_properties(BOOL d3d11)
hr
=
ID2D1DeviceContext_CreateEffect
(
ctx
.
context
,
&
CLSID_TestEffect
,
&
effect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
check_system_properties
(
effect
,
FALSE
);
check_system_properties
(
effect
);
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_CLSID
,
D2D1_PROPERTY_TYPE_CLSID
,
(
BYTE
*
)
&
clsid
,
sizeof
(
clsid
));
...
...
@@ -11899,14 +11942,12 @@ static void test_effect_properties(BOOL d3d11)
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_MIN_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
min_inputs
,
sizeof
(
min_inputs
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine_if
(
test
->
min_inputs
==
0
)
ok
(
min_inputs
==
test
->
min_inputs
,
"Got unexpected min inputs %u, expected %u.
\n
"
,
min_inputs
,
test
->
min_inputs
);
hr
=
ID2D1Effect_GetValue
(
effect
,
D2D1_PROPERTY_MAX_INPUTS
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
max_inputs
,
sizeof
(
max_inputs
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine_if
(
test
->
max_inputs
==
0
)
ok
(
max_inputs
==
test
->
max_inputs
,
"Got unexpected max inputs %u, expected %u.
\n
"
,
max_inputs
,
test
->
max_inputs
);
...
...
@@ -12226,7 +12267,7 @@ static void test_effect_2d_affine(BOOL d3d11)
hr
=
ID2D1DeviceContext_CreateEffect
(
context
,
&
CLSID_D2D12DAffineTransform
,
&
effect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
check_system_properties
(
effect
,
TRUE
);
check_system_properties
(
effect
);
count
=
ID2D1Effect_GetPropertyCount
(
effect
);
todo_wine
ok
(
count
==
4
,
"Got unexpected property count %u.
\n
"
,
count
);
...
...
@@ -12369,7 +12410,7 @@ static void test_effect_crop(BOOL d3d11)
hr
=
ID2D1DeviceContext_CreateEffect
(
context
,
&
CLSID_D2D1Crop
,
&
effect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
check_system_properties
(
effect
,
TRUE
);
check_system_properties
(
effect
);
count
=
ID2D1Effect_GetPropertyCount
(
effect
);
todo_wine
ok
(
count
==
2
,
"Got unexpected property count %u.
\n
"
,
count
);
...
...
@@ -12453,7 +12494,7 @@ static void test_effect_grayscale(BOOL d3d11)
hr
=
ID2D1DeviceContext_CreateEffect
(
context
,
&
CLSID_D2D1Grayscale
,
&
effect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
check_system_properties
(
effect
,
TRUE
);
check_system_properties
(
effect
);
count
=
ID2D1Effect_GetPropertyCount
(
effect
);
ok
(
!
count
,
"Got unexpected property count %u.
\n
"
,
count
);
...
...
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