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
cbd83b4e
Commit
cbd83b4e
authored
May 13, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/layout: Use array allocation helper for typography features.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a4b3420e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
34 deletions
+29
-34
layout.c
dlls/dwrite/layout.c
+29
-34
No files found.
dlls/dwrite/layout.c
View file @
cbd83b4e
...
...
@@ -304,11 +304,11 @@ struct dwrite_trimmingsign {
struct
dwrite_typography
{
IDWriteTypography
IDWriteTypography_iface
;
LONG
ref
;
LONG
ref
count
;
DWRITE_FONT_FEATURE
*
features
;
UINT32
allocated
;
UINT32
count
;
size_t
capacity
;
size_t
count
;
};
static
const
IDWriteTextFormat2Vtbl
dwritetextformatvtbl
;
...
...
@@ -5689,9 +5689,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
static
HRESULT
WINAPI
dwritetypography_QueryInterface
(
IDWriteTypography
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
typography
,
debugstr_guid
(
riid
),
obj
);
TRACE
(
"%p, %s, %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualIID
(
riid
,
&
IID_IDWriteTypography
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
...
...
@@ -5709,57 +5707,61 @@ static HRESULT WINAPI dwritetypography_QueryInterface(IDWriteTypography *iface,
static
ULONG
WINAPI
dwritetypography_AddRef
(
IDWriteTypography
*
iface
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
typography
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
typography
,
ref
);
return
ref
;
ULONG
refcount
=
InterlockedIncrement
(
&
typography
->
refcount
);
TRACE
(
"%p, refcount %d.
\n
"
,
iface
,
refcount
);
return
refcount
;
}
static
ULONG
WINAPI
dwritetypography_Release
(
IDWriteTypography
*
iface
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
typography
->
ref
);
ULONG
ref
count
=
InterlockedDecrement
(
&
typography
->
refcount
);
TRACE
(
"
(%p)->(%d)
\n
"
,
typography
,
ref
);
TRACE
(
"
%p, refcount %d.
\n
"
,
iface
,
refcount
);
if
(
!
ref
)
{
if
(
!
refcount
)
{
heap_free
(
typography
->
features
);
heap_free
(
typography
);
}
return
ref
;
return
ref
count
;
}
static
HRESULT
WINAPI
dwritetypography_AddFontFeature
(
IDWriteTypography
*
iface
,
DWRITE_FONT_FEATURE
feature
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
TRACE
(
"(%p)->(%x %u)
\n
"
,
typography
,
feature
.
nameTag
,
feature
.
parameter
);
if
(
typography
->
count
==
typography
->
allocated
)
{
DWRITE_FONT_FEATURE
*
ptr
=
heap_realloc
(
typography
->
features
,
2
*
typography
->
allocated
*
sizeof
(
DWRITE_FONT_FEATURE
));
if
(
!
ptr
)
return
E_OUTOFMEMORY
;
TRACE
(
"%p, %s, %u.
\n
"
,
iface
,
debugstr_tag
(
feature
.
nameTag
),
feature
.
parameter
);
typography
->
features
=
ptr
;
typography
->
allocated
*=
2
;
if
(
!
dwrite_array_reserve
((
void
**
)
&
typography
->
features
,
&
typography
->
capacity
,
typography
->
count
+
1
,
sizeof
(
*
typography
->
features
)))
{
return
E_OUTOFMEMORY
;
}
typography
->
features
[
typography
->
count
++
]
=
feature
;
return
S_OK
;
}
static
UINT32
WINAPI
dwritetypography_GetFontFeatureCount
(
IDWriteTypography
*
iface
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
TRACE
(
"(%p)
\n
"
,
typography
);
TRACE
(
"%p.
\n
"
,
iface
);
return
typography
->
count
;
}
static
HRESULT
WINAPI
dwritetypography_GetFontFeature
(
IDWriteTypography
*
iface
,
UINT32
index
,
DWRITE_FONT_FEATURE
*
feature
)
static
HRESULT
WINAPI
dwritetypography_GetFontFeature
(
IDWriteTypography
*
iface
,
UINT32
index
,
DWRITE_FONT_FEATURE
*
feature
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
TRACE
(
"
(%p)->(%u %p)
\n
"
,
typography
,
index
,
feature
);
TRACE
(
"
%p, %u, %p.
\n
"
,
iface
,
index
,
feature
);
if
(
index
>=
typography
->
count
)
return
E_INVALIDARG
;
...
...
@@ -5783,21 +5785,14 @@ HRESULT create_typography(IDWriteTypography **ret)
*
ret
=
NULL
;
typography
=
heap_alloc
(
sizeof
(
*
typography
));
typography
=
heap_alloc
_zero
(
sizeof
(
*
typography
));
if
(
!
typography
)
return
E_OUTOFMEMORY
;
typography
->
IDWriteTypography_iface
.
lpVtbl
=
&
dwritetypographyvtbl
;
typography
->
ref
=
1
;
typography
->
allocated
=
2
;
typography
->
count
=
0
;
typography
->
features
=
heap_calloc
(
typography
->
allocated
,
sizeof
(
*
typography
->
features
));
if
(
!
typography
->
features
)
{
heap_free
(
typography
);
return
E_OUTOFMEMORY
;
}
typography
->
refcount
=
1
;
*
ret
=
&
typography
->
IDWriteTypography_iface
;
return
S_OK
;
}
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