Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
bf0c621c
Commit
bf0c621c
authored
Jun 26, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1/effect: Initial implementation of property access methods.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
216e56ac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
50 deletions
+154
-50
effect.c
dlls/d2d1/effect.c
+151
-49
d2d1.c
dlls/d2d1/tests/d2d1.c
+2
-1
d2d1_1.idl
include/d2d1_1.idl
+1
-0
No files found.
dlls/d2d1/effect.c
View file @
bf0c621c
...
@@ -135,6 +135,89 @@ HRESULT d2d_effect_properties_add(struct d2d_effect_properties *props, const WCH
...
@@ -135,6 +135,89 @@ HRESULT d2d_effect_properties_add(struct d2d_effect_properties *props, const WCH
return
S_OK
;
return
S_OK
;
}
}
static
struct
d2d_effect_property
*
d2d_effect_properties_get_property_by_index
(
const
struct
d2d_effect_properties
*
properties
,
UINT32
index
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
properties
->
count
;
++
i
)
{
if
(
properties
->
properties
[
i
].
index
==
index
)
return
&
properties
->
properties
[
i
];
}
return
NULL
;
}
static
struct
d2d_effect_property
*
d2d_effect_properties_get_property_by_name
(
const
struct
d2d_effect_properties
*
properties
,
const
WCHAR
*
name
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
properties
->
count
;
++
i
)
{
if
(
!
wcscmp
(
properties
->
properties
[
i
].
name
,
name
))
return
&
properties
->
properties
[
i
];
}
return
NULL
;
}
static
UINT32
d2d_effect_properties_get_value_size
(
const
struct
d2d_effect
*
effect
,
const
struct
d2d_effect_properties
*
properties
,
UINT32
index
)
{
struct
d2d_effect_property
*
prop
;
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_index
(
properties
,
index
)))
return
0
;
/* FIXME: use gettter */
return
prop
->
size
;
}
static
HRESULT
d2d_effect_return_string
(
const
WCHAR
*
str
,
WCHAR
*
buffer
,
UINT32
buffer_size
)
{
UINT32
size
=
str
?
wcslen
(
str
)
:
0
;
if
(
size
>=
buffer_size
)
return
D2DERR_INSUFFICIENT_BUFFER
;
if
(
str
)
memcpy
(
buffer
,
str
,
(
size
+
1
)
*
sizeof
(
*
buffer
));
else
*
buffer
=
0
;
return
S_OK
;
}
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
)
{
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 */
switch
(
prop
->
type
)
{
case
D2D1_PROPERTY_TYPE_ARRAY
:
case
D2D1_PROPERTY_TYPE_BLOB
:
FIXME
(
"Unimplemented for type %u.
\n
"
,
prop
->
type
);
return
E_NOTIMPL
;
case
D2D1_PROPERTY_TYPE_STRING
:
return
d2d_effect_return_string
(
prop
->
data
.
ptr
,
(
WCHAR
*
)
value
,
size
/
sizeof
(
WCHAR
));
default:
memcpy
(
value
,
properties
->
data
.
ptr
+
prop
->
data
.
offset
,
size
);
break
;
}
return
S_OK
;
}
static
HRESULT
d2d_effect_property_set_value
(
struct
d2d_effect_property
*
property
,
D2D1_PROPERTY_TYPE
type
,
const
BYTE
*
value
,
UINT32
size
)
{
FIXME
(
"Unimplemented.
\n
"
);
return
S_OK
;
}
void
d2d_effect_properties_cleanup
(
struct
d2d_effect_properties
*
props
)
void
d2d_effect_properties_cleanup
(
struct
d2d_effect_properties
*
props
)
{
{
struct
d2d_effect_property
*
p
;
struct
d2d_effect_property
*
p
;
...
@@ -607,112 +690,131 @@ static ULONG STDMETHODCALLTYPE d2d_effect_Release(ID2D1Effect *iface)
...
@@ -607,112 +690,131 @@ static ULONG STDMETHODCALLTYPE d2d_effect_Release(ID2D1Effect *iface)
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetPropertyCount
(
ID2D1Effect
*
iface
)
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetPropertyCount
(
ID2D1Effect
*
iface
)
{
{
FIXME
(
"iface %p stub!
\n
"
,
iface
);
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
return
0
;
TRACE
(
"iface %p.
\n
"
,
iface
);
return
effect
->
properties
.
custom_count
;
}
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetPropertyName
(
ID2D1Effect
*
iface
,
UINT32
index
,
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetPropertyName
(
ID2D1Effect
*
iface
,
UINT32
index
,
WCHAR
*
name
,
UINT32
name_count
)
WCHAR
*
name
,
UINT32
name_count
)
{
{
FIXME
(
"iface %p, index %u, name %p, name_count %u stub!
\n
"
,
iface
,
index
,
name
,
name_count
);
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
struct
d2d_effect_property
*
prop
;
return
E_NOTIMPL
;
TRACE
(
"iface %p, index %u, name %p, name_count %u.
\n
"
,
iface
,
index
,
name
,
name_count
);
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_index
(
&
effect
->
properties
,
index
)))
return
D2DERR_INVALID_PROPERTY
;
return
d2d_effect_return_string
(
prop
->
name
,
name
,
name_count
);
}
}
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetPropertyNameLength
(
ID2D1Effect
*
iface
,
UINT32
index
)
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetPropertyNameLength
(
ID2D1Effect
*
iface
,
UINT32
index
)
{
{
FIXME
(
"iface %p, index %u stub!
\n
"
,
iface
,
index
);
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
struct
d2d_effect_property
*
prop
;
return
0
;
TRACE
(
"iface %p, index %u.
\n
"
,
iface
,
index
);
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_index
(
&
effect
->
properties
,
index
)))
return
D2DERR_INVALID_PROPERTY
;
return
wcslen
(
prop
->
name
)
+
1
;
}
}
static
D2D1_PROPERTY_TYPE
STDMETHODCALLTYPE
d2d_effect_GetType
(
ID2D1Effect
*
iface
,
UINT32
index
)
static
D2D1_PROPERTY_TYPE
STDMETHODCALLTYPE
d2d_effect_GetType
(
ID2D1Effect
*
iface
,
UINT32
index
)
{
{
FIXME
(
"iface %p, index %u stub!
\n
"
,
iface
,
index
);
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
struct
d2d_effect_property
*
prop
;
return
0
;
TRACE
(
"iface %p, index %#x.
\n
"
,
iface
,
index
);
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_index
(
&
effect
->
properties
,
index
)))
return
D2D1_PROPERTY_TYPE_UNKNOWN
;
return
prop
->
type
;
}
}
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetPropertyIndex
(
ID2D1Effect
*
iface
,
const
WCHAR
*
name
)
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetPropertyIndex
(
ID2D1Effect
*
iface
,
const
WCHAR
*
name
)
{
{
FIXME
(
"iface %p, name %s stub!
\n
"
,
iface
,
debugstr_w
(
name
));
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
struct
d2d_effect_property
*
prop
;
return
0
;
TRACE
(
"iface %p, name %s.
\n
"
,
iface
,
debugstr_w
(
name
));
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_name
(
&
effect
->
properties
,
name
)))
return
D2D1_INVALID_PROPERTY_INDEX
;
return
prop
->
index
;
}
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_SetValueByName
(
ID2D1Effect
*
iface
,
const
WCHAR
*
name
,
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_SetValueByName
(
ID2D1Effect
*
iface
,
const
WCHAR
*
name
,
D2D1_PROPERTY_TYPE
type
,
const
BYTE
*
value
,
UINT32
value_size
)
D2D1_PROPERTY_TYPE
type
,
const
BYTE
*
value
,
UINT32
value_size
)
{
{
FIXME
(
"iface %p, name %s, type %#x, value %p, value_size %u stub!
\n
"
,
iface
,
debugstr_w
(
name
),
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
struct
d2d_effect_property
*
prop
;
TRACE
(
"iface %p, name %s, type %u, value %p, value_size %u.
\n
"
,
iface
,
debugstr_w
(
name
),
type
,
value
,
value_size
);
type
,
value
,
value_size
);
return
E_NOTIMPL
;
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
);
}
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_SetValue
(
ID2D1Effect
*
iface
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_SetValue
(
ID2D1Effect
*
iface
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
const
BYTE
*
value
,
UINT32
value_size
)
const
BYTE
*
value
,
UINT32
value_size
)
{
{
FIXME
(
"iface %p, index %u, type %#x, value %p, value_size %u stub!
\n
"
,
iface
,
index
,
type
,
value
,
value_size
);
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
struct
d2d_effect_property
*
prop
;
return
S_OK
;
TRACE
(
"iface %p, index %#x, type %u, value %p, value_size %u.
\n
"
,
iface
,
index
,
type
,
value
,
value_size
);
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
);
}
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetValueByName
(
ID2D1Effect
*
iface
,
const
WCHAR
*
name
,
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetValueByName
(
ID2D1Effect
*
iface
,
const
WCHAR
*
name
,
D2D1_PROPERTY_TYPE
type
,
BYTE
*
value
,
UINT32
value_size
)
D2D1_PROPERTY_TYPE
type
,
BYTE
*
value
,
UINT32
value_size
)
{
{
FIXME
(
"iface %p, name %s, type %#x, value %p, value_size %u stub!
\n
"
,
iface
,
debugstr_w
(
name
),
type
,
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
struct
d2d_effect_property
*
prop
;
TRACE
(
"iface %p, name %s, type %#x, value %p, value_size %u.
\n
"
,
iface
,
debugstr_w
(
name
),
type
,
value
,
value_size
);
value
,
value_size
);
return
E_NOTIMPL
;
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_name
(
&
effect
->
properties
,
name
)))
return
D2DERR_INVALID_PROPERTY
;
return
d2d_effect_property_get_value
(
effect
,
&
effect
->
properties
,
prop
,
type
,
value
,
value_size
);
}
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetValue
(
ID2D1Effect
*
iface
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetValue
(
ID2D1Effect
*
iface
,
UINT32
index
,
D2D1_PROPERTY_TYPE
type
,
BYTE
*
value
,
UINT32
value_size
)
BYTE
*
value
,
UINT32
value_size
)
{
{
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
const
void
*
src
;
struct
d2d_effect_property
*
prop
;
TRACE
(
"iface %p, index %
u, type %#x
, value %p, value_size %u.
\n
"
,
iface
,
index
,
type
,
value
,
value_size
);
TRACE
(
"iface %p, index %
#x, type %u
, value %p, value_size %u.
\n
"
,
iface
,
index
,
type
,
value
,
value_size
);
switch
(
index
)
if
(
!
(
prop
=
d2d_effect_properties_get_property_by_index
(
&
effect
->
properties
,
index
)))
{
case
D2D1_PROPERTY_CLSID
:
if
((
type
!=
D2D1_PROPERTY_TYPE_UNKNOWN
&&
type
!=
D2D1_PROPERTY_TYPE_CLSID
)
||
value_size
!=
sizeof
(
*
effect
->
info
->
clsid
))
return
E_INVALIDARG
;
src
=
effect
->
info
->
clsid
;
break
;
case
D2D1_PROPERTY_MIN_INPUTS
:
if
((
type
!=
D2D1_PROPERTY_TYPE_UNKNOWN
&&
type
!=
D2D1_PROPERTY_TYPE_UINT32
)
||
value_size
!=
sizeof
(
effect
->
info
->
min_inputs
))
return
E_INVALIDARG
;
src
=
&
effect
->
info
->
min_inputs
;
break
;
case
D2D1_PROPERTY_MAX_INPUTS
:
if
((
type
!=
D2D1_PROPERTY_TYPE_UNKNOWN
&&
type
!=
D2D1_PROPERTY_TYPE_UINT32
)
||
value_size
!=
sizeof
(
effect
->
info
->
max_inputs
))
return
E_INVALIDARG
;
src
=
&
effect
->
info
->
max_inputs
;
break
;
default:
if
(
index
<
D2D1_PROPERTY_CLSID
)
FIXME
(
"Custom properties are not supported.
\n
"
);
else
if
(
index
<=
D2D1_PROPERTY_MAX_INPUTS
)
FIXME
(
"Standard property %#x is not supported.
\n
"
,
index
);
return
D2DERR_INVALID_PROPERTY
;
return
D2DERR_INVALID_PROPERTY
;
}
memcpy
(
value
,
src
,
value_size
);
return
d2d_effect_property_get_value
(
effect
,
&
effect
->
properties
,
prop
,
type
,
value
,
value_size
);
return
S_OK
;
}
}
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetValueSize
(
ID2D1Effect
*
iface
,
UINT32
index
)
static
UINT32
STDMETHODCALLTYPE
d2d_effect_GetValueSize
(
ID2D1Effect
*
iface
,
UINT32
index
)
{
{
FIXME
(
"iface %p, index %u stub!
\n
"
,
iface
,
index
);
struct
d2d_effect
*
effect
=
impl_from_ID2D1Effect
(
iface
);
return
0
;
TRACE
(
"iface %p, index %#x.
\n
"
,
iface
,
index
);
return
d2d_effect_properties_get_value_size
(
effect
,
&
effect
->
properties
,
index
);
}
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetSubProperties
(
ID2D1Effect
*
iface
,
UINT32
index
,
ID2D1Properties
**
props
)
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_GetSubProperties
(
ID2D1Effect
*
iface
,
UINT32
index
,
ID2D1Properties
**
props
)
...
...
dlls/d2d1/tests/d2d1.c
View file @
bf0c621c
...
@@ -11290,9 +11290,9 @@ static void test_effect_2d_affine(BOOL d3d11)
...
@@ -11290,9 +11290,9 @@ static void test_effect_2d_affine(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1Effect_SetInput
(
effect
,
0
,
(
ID2D1Image
*
)
bitmap
,
FALSE
);
ID2D1Effect_SetInput
(
effect
,
0
,
(
ID2D1Image
*
)
bitmap
,
FALSE
);
todo_wine
hr
=
ID2D1Effect_SetValue
(
effect
,
D2D1_2DAFFINETRANSFORM_PROP_TRANSFORM_MATRIX
,
hr
=
ID2D1Effect_SetValue
(
effect
,
D2D1_2DAFFINETRANSFORM_PROP_TRANSFORM_MATRIX
,
D2D1_PROPERTY_TYPE_MATRIX_3X2
,
(
const
BYTE
*
)
test
->
matrix
,
sizeof
(
*
test
->
matrix
));
D2D1_PROPERTY_TYPE_MATRIX_3X2
,
(
const
BYTE
*
)
test
->
matrix
,
sizeof
(
*
test
->
matrix
));
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1Effect_GetOutput
(
effect
,
&
output
);
ID2D1Effect_GetOutput
(
effect
,
&
output
);
...
@@ -11402,6 +11402,7 @@ static void test_effect_crop(BOOL d3d11)
...
@@ -11402,6 +11402,7 @@ static void test_effect_crop(BOOL d3d11)
ID2D1Effect_SetInput
(
effect
,
0
,
(
ID2D1Image
*
)
bitmap
,
FALSE
);
ID2D1Effect_SetInput
(
effect
,
0
,
(
ID2D1Image
*
)
bitmap
,
FALSE
);
hr
=
ID2D1Effect_SetValue
(
effect
,
D2D1_CROP_PROP_RECT
,
D2D1_PROPERTY_TYPE_VECTOR4
,
hr
=
ID2D1Effect_SetValue
(
effect
,
D2D1_CROP_PROP_RECT
,
D2D1_PROPERTY_TYPE_VECTOR4
,
(
const
BYTE
*
)
&
test
->
crop_rect
,
sizeof
(
test
->
crop_rect
));
(
const
BYTE
*
)
&
test
->
crop_rect
,
sizeof
(
test
->
crop_rect
));
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1Effect_GetOutput
(
effect
,
&
output
);
ID2D1Effect_GetOutput
(
effect
,
&
output
);
...
...
include/d2d1_1.idl
View file @
bf0c621c
...
@@ -33,6 +33,7 @@ cpp_quote("#ifndef __dwrite_h__")
...
@@ -33,6 +33,7 @@ cpp_quote("#ifndef __dwrite_h__")
/*
already
defined
in
dwrite
.
h
but
needed
for
WIDL
*/
/*
already
defined
in
dwrite
.
h
but
needed
for
WIDL
*/
typedef
struct
DWRITE_GLYPH_RUN_DESCRIPTION
DWRITE_GLYPH_RUN_DESCRIPTION
;
typedef
struct
DWRITE_GLYPH_RUN_DESCRIPTION
DWRITE_GLYPH_RUN_DESCRIPTION
;
cpp_quote
(
"#endif /* __dwrite_h__ */"
)
cpp_quote
(
"#endif /* __dwrite_h__ */"
)
cpp_quote
(
"#define D2D1_INVALID_PROPERTY_INDEX UINT_MAX"
)
typedef
enum
D2D1_DEVICE_CONTEXT_OPTIONS
typedef
enum
D2D1_DEVICE_CONTEXT_OPTIONS
{
{
...
...
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