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
a782605e
Commit
a782605e
authored
May 14, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/analyzer: Use array allocation helper for fallback builder.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3cfd0a7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
41 deletions
+29
-41
analyzer.c
dlls/dwrite/analyzer.c
+29
-41
No files found.
dlls/dwrite/analyzer.c
View file @
a782605e
...
...
@@ -236,13 +236,14 @@ struct dwrite_fontfallback {
UINT32
mappings_count
;
};
struct
dwrite_fontfallback_builder
{
struct
dwrite_fontfallback_builder
{
IDWriteFontFallbackBuilder
IDWriteFontFallbackBuilder_iface
;
LONG
ref
;
LONG
ref
count
;
IDWriteFactory5
*
factory
;
struct
fallback_mapping
*
mappings
;
UINT32
mappings_count
;
UINT32
mappings_capacity
;
size_t
size
;
size_t
count
;
};
struct
dwrite_numbersubstitution
{
...
...
@@ -2228,9 +2229,7 @@ static const IDWriteFontFallbackVtbl customfontfallbackvtbl =
static
HRESULT
WINAPI
fontfallbackbuilder_QueryInterface
(
IDWriteFontFallbackBuilder
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
dwrite_fontfallback_builder
*
fallbackbuilder
=
impl_from_IDWriteFontFallbackBuilder
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
fallbackbuilder
,
debugstr_guid
(
riid
),
obj
);
TRACE
(
"%p, %s, %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualIID
(
riid
,
&
IID_IDWriteFontFallbackBuilder
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
...
...
@@ -2247,22 +2246,25 @@ static HRESULT WINAPI fontfallbackbuilder_QueryInterface(IDWriteFontFallbackBuil
static
ULONG
WINAPI
fontfallbackbuilder_AddRef
(
IDWriteFontFallbackBuilder
*
iface
)
{
struct
dwrite_fontfallback_builder
*
fallbackbuilder
=
impl_from_IDWriteFontFallbackBuilder
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
fallbackbuilder
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
fallbackbuilder
,
ref
);
return
ref
;
ULONG
refcount
=
InterlockedIncrement
(
&
fallbackbuilder
->
refcount
);
TRACE
(
"%p, refcount %d.
\n
"
,
iface
,
refcount
);
return
refcount
;
}
static
ULONG
WINAPI
fontfallbackbuilder_Release
(
IDWriteFontFallbackBuilder
*
iface
)
{
struct
dwrite_fontfallback_builder
*
fallbackbuilder
=
impl_from_IDWriteFontFallbackBuilder
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
fallbackbuilder
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
fallbackbuilder
,
ref
);
ULONG
refcount
=
InterlockedDecrement
(
&
fallbackbuilder
->
refcount
);
size_t
i
;
if
(
!
ref
)
{
UINT32
i
;
TRACE
(
"%p, refcount %d.
\n
"
,
iface
,
refcount
);
for
(
i
=
0
;
i
<
fallbackbuilder
->
mappings_count
;
i
++
)
{
if
(
!
refcount
)
{
for
(
i
=
0
;
i
<
fallbackbuilder
->
count
;
++
i
)
{
struct
fallback_mapping
*
mapping
=
&
fallbackbuilder
->
mappings
[
i
];
UINT32
j
;
...
...
@@ -2281,7 +2283,7 @@ static ULONG WINAPI fontfallbackbuilder_Release(IDWriteFontFallbackBuilder *ifac
heap_free
(
fallbackbuilder
);
}
return
ref
;
return
ref
count
;
}
static
HRESULT
WINAPI
fontfallbackbuilder_AddMapping
(
IDWriteFontFallbackBuilder
*
iface
,
...
...
@@ -2292,8 +2294,8 @@ static HRESULT WINAPI fontfallbackbuilder_AddMapping(IDWriteFontFallbackBuilder
struct
fallback_mapping
*
mapping
;
UINT32
i
;
TRACE
(
"
(%p)->(%p, %u, %p, %u, %p, %s, %s, %f)
\n
"
,
fallbackbuilder
,
ranges
,
ranges_count
,
target_families
,
families_count
,
collection
,
debugstr_w
(
locale
),
debugstr_w
(
base_family
),
scale
);
TRACE
(
"
%p, %p, %u, %p, %u, %p, %s, %s, %f.
\n
"
,
iface
,
ranges
,
ranges_count
,
target_families
,
families_count
,
collection
,
debugstr_w
(
locale
),
debugstr_w
(
base_family
),
scale
);
if
(
!
ranges
||
ranges_count
==
0
||
!
target_families
||
families_count
==
0
||
scale
<
0
.
0
f
)
return
E_INVALIDARG
;
...
...
@@ -2301,25 +2303,13 @@ static HRESULT WINAPI fontfallbackbuilder_AddMapping(IDWriteFontFallbackBuilder
if
(
base_family
)
FIXME
(
"base family ignored.
\n
"
);
if
(
fallbackbuilder
->
mappings_count
==
fallbackbuilder
->
mappings_capacity
)
{
struct
fallback_mapping
*
mappings
;
if
(
fallbackbuilder
->
mappings_capacity
==
0
)
{
if
((
mappings
=
heap_calloc
(
16
,
sizeof
(
*
mappings
))))
fallbackbuilder
->
mappings_capacity
=
16
;
}
else
{
if
((
mappings
=
heap_realloc
(
fallbackbuilder
->
mappings
,
sizeof
(
*
fallbackbuilder
->
mappings
)
*
fallbackbuilder
->
mappings_capacity
*
2
)))
fallbackbuilder
->
mappings_capacity
*=
2
;
}
if
(
!
mappings
)
return
E_OUTOFMEMORY
;
fallbackbuilder
->
mappings
=
mappings
;
if
(
!
dwrite_array_reserve
((
void
**
)
&
fallbackbuilder
->
mappings
,
&
fallbackbuilder
->
size
,
fallbackbuilder
->
count
+
1
,
sizeof
(
*
fallbackbuilder
->
mappings
)))
{
return
E_OUTOFMEMORY
;
}
mapping
=
&
fallbackbuilder
->
mappings
[
fallbackbuilder
->
mappings_
count
++
];
mapping
=
&
fallbackbuilder
->
mappings
[
fallbackbuilder
->
count
++
];
mapping
->
ranges
=
heap_calloc
(
ranges_count
,
sizeof
(
*
mapping
->
ranges
));
memcpy
(
mapping
->
ranges
,
ranges
,
sizeof
(
*
mapping
->
ranges
)
*
ranges_count
);
...
...
@@ -2339,9 +2329,7 @@ static HRESULT WINAPI fontfallbackbuilder_AddMapping(IDWriteFontFallbackBuilder
static
HRESULT
WINAPI
fontfallbackbuilder_AddMappings
(
IDWriteFontFallbackBuilder
*
iface
,
IDWriteFontFallback
*
fallback
)
{
struct
dwrite_fontfallback_builder
*
fallbackbuilder
=
impl_from_IDWriteFontFallbackBuilder
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
fallbackbuilder
,
fallback
);
FIXME
(
"%p, %p stub.
\n
"
,
iface
,
fallback
);
return
E_NOTIMPL
;
}
...
...
@@ -2352,7 +2340,7 @@ static HRESULT WINAPI fontfallbackbuilder_CreateFontFallback(IDWriteFontFallback
struct
dwrite_fontfallback_builder
*
fallbackbuilder
=
impl_from_IDWriteFontFallbackBuilder
(
iface
);
struct
dwrite_fontfallback
*
fallback
;
FIXME
(
"
(%p)->(%p): stub
\n
"
,
fallbackbuilder
,
ret
);
FIXME
(
"
%p, %p stub.
\n
"
,
iface
,
ret
);
*
ret
=
NULL
;
...
...
@@ -2390,7 +2378,7 @@ HRESULT create_fontfallback_builder(IDWriteFactory5 *factory, IDWriteFontFallbac
return
E_OUTOFMEMORY
;
builder
->
IDWriteFontFallbackBuilder_iface
.
lpVtbl
=
&
fontfallbackbuildervtbl
;
builder
->
ref
=
1
;
builder
->
ref
count
=
1
;
builder
->
factory
=
factory
;
IDWriteFactory5_AddRef
(
builder
->
factory
);
...
...
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