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
e2908463
Commit
e2908463
authored
Jun 27, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1/effect: Use property binding methods.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
49c801d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
18 deletions
+33
-18
effect.c
dlls/d2d1/effect.c
+32
-7
d2d1.c
dlls/d2d1/tests/d2d1.c
+1
-11
No files found.
dlls/d2d1/effect.c
View file @
e2908463
...
...
@@ -278,11 +278,16 @@ static UINT32 d2d_effect_properties_get_value_size(const struct d2d_effect *effe
const
struct
d2d_effect_properties
*
properties
,
UINT32
index
)
{
struct
d2d_effect_property
*
prop
;
UINT32
size
;
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_index
(
properties
,
index
)))
return
0
;
/* FIXME: use gettter */
if
(
prop
->
get_function
)
{
if
(
FAILED
(
prop
->
get_function
((
IUnknown
*
)
effect
->
impl
,
NULL
,
0
,
&
size
)))
return
0
;
return
size
;
}
return
prop
->
size
;
}
...
...
@@ -300,10 +305,13 @@ static HRESULT d2d_effect_property_get_value(const struct d2d_effect *effect,
const
struct
d2d_effect_properties
*
properties
,
const
struct
d2d_effect_property
*
prop
,
D2D1_PROPERTY_TYPE
type
,
BYTE
*
value
,
UINT32
size
)
{
UINT32
actual_size
;
if
(
type
!=
D2D1_PROPERTY_TYPE_UNKNOWN
&&
prop
->
type
!=
type
)
return
E_INVALIDARG
;
if
(
prop
->
type
!=
D2D1_PROPERTY_TYPE_STRING
&&
prop
->
size
!=
size
)
return
E_INVALIDARG
;
/* FIXME: use getter */
if
(
prop
->
get_function
)
return
prop
->
get_function
((
IUnknown
*
)
effect
->
impl
,
value
,
size
,
&
actual_size
);
switch
(
prop
->
type
)
{
...
...
@@ -321,12 +329,29 @@ static HRESULT d2d_effect_property_get_value(const struct d2d_effect *effect,
return
S_OK
;
}
static
HRESULT
d2d_effect_property_set_value
(
struct
d2d_effect_property
*
property
,
static
HRESULT
d2d_effect_property_set_value
(
const
struct
d2d_effect
*
effect
,
struct
d2d_effect_properties
*
properties
,
struct
d2d_effect_property
*
prop
,
D2D1_PROPERTY_TYPE
type
,
const
BYTE
*
value
,
UINT32
size
)
{
if
(
property
->
readonly
)
return
E_INVALIDARG
;
if
(
prop
->
readonly
)
return
E_INVALIDARG
;
if
(
type
!=
D2D1_PROPERTY_TYPE_UNKNOWN
&&
prop
->
type
!=
type
)
return
E_INVALIDARG
;
if
(
prop
->
get_function
&&
!
prop
->
set_function
)
return
E_INVALIDARG
;
if
(
prop
->
index
<
0x80000000
&&
!
prop
->
set_function
)
return
E_INVALIDARG
;
FIXME
(
"Unimplemented.
\n
"
);
if
(
prop
->
set_function
)
return
prop
->
set_function
((
IUnknown
*
)
effect
->
impl
,
value
,
size
);
if
(
prop
->
size
!=
size
)
return
E_INVALIDARG
;
switch
(
prop
->
type
)
{
case
D2D1_PROPERTY_TYPE_BOOL
:
case
D2D1_PROPERTY_TYPE_UINT32
:
memcpy
(
properties
->
data
.
ptr
+
prop
->
data
.
offset
,
value
,
size
);
break
;
default:
FIXME
(
"Unhandled type %u.
\n
"
,
prop
->
type
);
}
return
S_OK
;
}
...
...
@@ -877,7 +902,7 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_SetValueByName(ID2D1Effect *iface, c
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_name
(
&
effect
->
properties
,
name
)))
return
D2DERR_INVALID_PROPERTY
;
return
d2d_effect_property_set_value
(
prop
,
type
,
value
,
value_size
);
return
d2d_effect_property_set_value
(
effect
,
&
effect
->
properties
,
prop
,
type
,
value
,
value_size
);
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_SetValue
(
ID2D1Effect
*
iface
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
...
...
@@ -891,7 +916,7 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_SetValue(ID2D1Effect *iface, UINT32
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_index
(
&
effect
->
properties
,
index
)))
return
D2DERR_INVALID_PROPERTY
;
return
d2d_effect_property_set_value
(
prop
,
type
,
value
,
value_size
);
return
d2d_effect_property_set_value
(
effect
,
&
effect
->
properties
,
prop
,
type
,
value
,
value_size
);
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetValueByName
(
ID2D1Effect
*
iface
,
const
WCHAR
*
name
,
...
...
dlls/d2d1/tests/d2d1.c
View file @
e2908463
...
...
@@ -10818,7 +10818,6 @@ static void test_effect_register(BOOL d3d11)
hr
=
ID2D1Effect_GetValueByName
(
effect
,
L"Context"
,
D2D1_PROPERTY_TYPE_IUNKNOWN
,
(
BYTE
*
)
&
effect_context
,
sizeof
(
effect_context
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
integer
==
10
,
"Got unexpected integer %u.
\n
"
,
integer
);
ok
(
effect_context
==
NULL
,
"Got unexpected effect context %p.
\n
"
,
effect_context
);
ID2D1Effect_Release
(
effect
);
...
...
@@ -10837,7 +10836,6 @@ static void test_effect_register(BOOL d3d11)
hr
=
ID2D1Effect_GetValueByName
(
effect
,
L"Context"
,
D2D1_PROPERTY_TYPE_IUNKNOWN
,
(
BYTE
*
)
&
effect_context
,
sizeof
(
effect_context
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
integer
==
10
,
"Got unexpected integer %u.
\n
"
,
integer
);
ok
(
effect_context
==
NULL
,
"Got unexpected effect context %p.
\n
"
,
effect_context
);
ID2D1Effect_Release
(
effect
);
...
...
@@ -11107,31 +11105,26 @@ static void test_effect_properties(BOOL d3d11)
hr
=
ID2D1Effect_GetValueByName
(
effect
,
L"Context"
,
D2D1_PROPERTY_TYPE_IUNKNOWN
,
(
BYTE
*
)
&
effect_context
,
sizeof
(
effect_context
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
effect_context
!=
NULL
&&
effect_context
!=
(
ID2D1EffectContext
*
)
0xdeadbeef
,
"Got unexpected effect context %p.
\n
"
,
effect_context
);
effect_context
=
(
ID2D1EffectContext
*
)
0xdeadbeef
;
hr
=
ID2D1Effect_GetValue
(
effect
,
0
,
D2D1_PROPERTY_TYPE_IUNKNOWN
,
(
BYTE
*
)
&
effect_context
,
sizeof
(
effect_context
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
effect_context
!=
NULL
&&
effect_context
!=
(
ID2D1EffectContext
*
)
0xdeadbeef
,
"Got unexpected effect context %p.
\n
"
,
effect_context
);
hr
=
ID2D1Effect_SetValue
(
effect
,
0
,
D2D1_PROPERTY_TYPE_IUNKNOWN
,
(
BYTE
*
)
&
effect_context
,
sizeof
(
effect_context
));
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
integer
=
0xdeadbeef
;
hr
=
ID2D1Effect_GetValueByName
(
effect
,
L"Integer"
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
integer
,
sizeof
(
integer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
integer
==
10
,
"Got unexpected integer %u."
,
integer
);
integer
=
0xdeadbeef
;
hr
=
ID2D1Effect_GetValue
(
effect
,
1
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
integer
,
sizeof
(
integer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
integer
==
10
,
"Got unexpected integer %u."
,
integer
);
integer
=
20
;
...
...
@@ -11140,8 +11133,7 @@ static void test_effect_properties(BOOL d3d11)
integer
=
0xdeadbeef
;
hr
=
ID2D1Effect_GetValue
(
effect
,
1
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
integer
,
sizeof
(
integer
));
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
integer
==
20
,
"Got unexpected integer %u."
,
integer
);
ok
(
integer
==
20
,
"Got unexpected integer %u
\n
."
,
integer
);
ID2D1Effect_Release
(
effect
);
hr
=
ID2D1Factory1_UnregisterEffect
(
factory
,
&
CLSID_TestEffect
);
...
...
@@ -11173,10 +11165,8 @@ static void test_effect_properties(BOOL d3d11)
ok
(
integer
==
0
,
"Got unexpected integer %u."
,
integer
);
hr
=
ID2D1Effect_SetValue
(
effect
,
0
,
D2D1_PROPERTY_TYPE_IUNKNOWN
,
(
BYTE
*
)
&
effect_context
,
sizeof
(
effect_context
));
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1Effect_SetValue
(
effect
,
1
,
D2D1_PROPERTY_TYPE_UINT32
,
(
BYTE
*
)
&
integer
,
sizeof
(
integer
));
todo_wine
ok
(
hr
==
E_INVALIDARG
||
broken
(
hr
==
S_OK
)
/* win8 */
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1Effect_Release
(
effect
);
...
...
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