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
d9f43904
Commit
d9f43904
authored
Jan 31, 2018
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Use d2d_array_reserve() in d2d_clip_stack_push().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fdaa6d8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
44 deletions
+30
-44
d2d1_private.h
dlls/d2d1/d2d1_private.h
+28
-2
geometry.c
dlls/d2d1/geometry.c
+0
-27
render_target.c
dlls/d2d1/render_target.c
+2
-15
No files found.
dlls/d2d1/d2d1_private.h
View file @
d9f43904
...
...
@@ -62,8 +62,8 @@ extern struct d2d_settings d2d_settings DECLSPEC_HIDDEN;
struct
d2d_clip_stack
{
D2D1_RECT_F
*
stack
;
unsigned
in
t
size
;
unsigned
in
t
count
;
size_
t
size
;
size_
t
count
;
};
struct
d2d_error_state
...
...
@@ -486,6 +486,32 @@ static inline void *d2d_calloc(size_t count, size_t size)
return
heap_alloc
(
s
);
}
static
inline
BOOL
d2d_array_reserve
(
void
**
elements
,
size_t
*
capacity
,
size_t
count
,
size_t
size
)
{
size_t
new_capacity
,
max_capacity
;
void
*
new_elements
;
if
(
count
<=
*
capacity
)
return
TRUE
;
max_capacity
=
~
(
SIZE_T
)
0
/
size
;
if
(
count
>
max_capacity
)
return
FALSE
;
new_capacity
=
max
(
4
,
*
capacity
);
while
(
new_capacity
<
count
&&
new_capacity
<=
max_capacity
/
2
)
new_capacity
*=
2
;
if
(
new_capacity
<
count
)
new_capacity
=
max_capacity
;
if
(
!
(
new_elements
=
heap_realloc
(
*
elements
,
new_capacity
*
size
)))
return
FALSE
;
*
elements
=
new_elements
;
*
capacity
=
new_capacity
;
return
TRUE
;
}
static
inline
void
d2d_matrix_multiply
(
D2D_MATRIX_3X2_F
*
a
,
const
D2D_MATRIX_3X2_F
*
b
)
{
D2D_MATRIX_3X2_F
tmp
=
*
a
;
...
...
dlls/d2d1/geometry.c
View file @
d9f43904
...
...
@@ -562,33 +562,6 @@ static void d2d_rect_get_bezier_segment_bounds(D2D_RECT_F *bounds, const D2D1_PO
d2d_rect_get_bezier_bounds
(
bounds
,
&
q
[
0
],
&
q
[
1
],
&
q
[
2
]);
}
static
BOOL
d2d_array_reserve
(
void
**
elements
,
size_t
*
capacity
,
size_t
element_count
,
size_t
element_size
)
{
size_t
new_capacity
,
max_capacity
;
void
*
new_elements
;
if
(
element_count
<=
*
capacity
)
return
TRUE
;
max_capacity
=
~
(
size_t
)
0
/
element_size
;
if
(
max_capacity
<
element_count
)
return
FALSE
;
new_capacity
=
max
(
*
capacity
,
4
);
while
(
new_capacity
<
element_count
&&
new_capacity
<=
max_capacity
/
2
)
new_capacity
*=
2
;
if
(
new_capacity
<
element_count
)
new_capacity
=
max_capacity
;
if
(
!
(
new_elements
=
heap_realloc
(
*
elements
,
new_capacity
*
element_size
)))
return
FALSE
;
*
elements
=
new_elements
;
*
capacity
=
new_capacity
;
return
TRUE
;
}
static
BOOL
d2d_figure_insert_vertex
(
struct
d2d_figure
*
figure
,
size_t
idx
,
D2D1_POINT_2F
vertex
)
{
if
(
!
d2d_array_reserve
((
void
**
)
&
figure
->
vertices
,
&
figure
->
vertices_size
,
...
...
dlls/d2d1/render_target.c
View file @
d9f43904
...
...
@@ -95,21 +95,8 @@ static BOOL d2d_clip_stack_push(struct d2d_clip_stack *stack, const D2D1_RECT_F
{
D2D1_RECT_F
r
;
if
(
stack
->
count
==
stack
->
size
)
{
D2D1_RECT_F
*
new_stack
;
unsigned
int
new_size
;
if
(
stack
->
size
>
UINT_MAX
/
2
)
return
FALSE
;
new_size
=
stack
->
size
*
2
;
if
(
!
(
new_stack
=
heap_realloc
(
stack
->
stack
,
new_size
*
sizeof
(
*
stack
->
stack
))))
return
FALSE
;
stack
->
stack
=
new_stack
;
stack
->
size
=
new_size
;
}
if
(
!
d2d_array_reserve
((
void
**
)
&
stack
->
stack
,
&
stack
->
size
,
stack
->
count
+
1
,
sizeof
(
*
stack
->
stack
)))
return
FALSE
;
r
=
*
rect
;
if
(
stack
->
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