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
fdaa6d8e
Commit
fdaa6d8e
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: Introduce a helper function to allocate arrays.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
15e46669
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
10 deletions
+21
-10
bitmap.c
dlls/d2d1/bitmap.c
+4
-2
brush.c
dlls/d2d1/brush.c
+2
-2
d2d1_private.h
dlls/d2d1/d2d1_private.h
+9
-0
geometry.c
dlls/d2d1/geometry.c
+3
-3
render_target.c
dlls/d2d1/render_target.c
+2
-2
stroke.c
dlls/d2d1/stroke.c
+1
-1
No files found.
dlls/d2d1/bitmap.c
View file @
fdaa6d8e
...
...
@@ -509,9 +509,11 @@ HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *d
}
pitch
=
((
bpp
*
size
.
width
)
+
15
)
&
~
15
;
data_size
=
pitch
*
size
.
height
;
if
(
!
(
data
=
heap_alloc
(
data_size
)))
if
(
pitch
/
bpp
<
size
.
width
)
return
E_OUTOFMEMORY
;
if
(
!
(
data
=
d2d_calloc
(
size
.
height
,
pitch
)))
return
E_OUTOFMEMORY
;
data_size
=
size
.
height
*
pitch
;
rect
.
X
=
0
;
rect
.
Y
=
0
;
...
...
dlls/d2d1/brush.c
View file @
fdaa6d8e
...
...
@@ -142,7 +142,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
unsigned
int
i
;
HRESULT
hr
;
if
(
!
(
data
=
heap_alloc_zero
(
2
*
stop_count
*
sizeof
(
*
data
))))
if
(
!
(
data
=
d2d_calloc
(
stop_count
,
2
*
sizeof
(
*
data
))))
{
ERR
(
"Failed to allocate data.
\n
"
);
return
E_OUTOFMEMORY
;
...
...
@@ -205,7 +205,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
(
*
gradient
)
->
view
=
view
;
(
*
gradient
)
->
stop_count
=
stop_count
;
if
(
!
((
*
gradient
)
->
stops
=
heap_alloc
(
stop_count
*
sizeof
(
*
stops
))))
if
(
!
((
*
gradient
)
->
stops
=
d2d_calloc
(
stop_count
,
sizeof
(
*
stops
))))
{
ID3D10ShaderResourceView_Release
(
view
);
heap_free
(
*
gradient
);
...
...
dlls/d2d1/d2d1_private.h
View file @
fdaa6d8e
...
...
@@ -477,6 +477,15 @@ void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *
ID2D1Geometry
*
src_geometry
,
const
D2D_MATRIX_3X2_F
*
transform
)
DECLSPEC_HIDDEN
;
struct
d2d_geometry
*
unsafe_impl_from_ID2D1Geometry
(
ID2D1Geometry
*
iface
)
DECLSPEC_HIDDEN
;
static
inline
void
*
d2d_calloc
(
size_t
count
,
size_t
size
)
{
SIZE_T
s
=
count
*
size
;
if
(
size
&&
s
/
size
!=
count
)
return
NULL
;
return
heap_alloc
(
s
);
}
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 @
fdaa6d8e
...
...
@@ -2052,7 +2052,7 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
return
S_OK
;
}
if
(
!
(
vertices
=
heap_alloc
(
vertex_count
*
sizeof
(
*
vertices
))))
if
(
!
(
vertices
=
d2d_calloc
(
vertex_count
,
sizeof
(
*
vertices
))))
return
E_OUTOFMEMORY
;
for
(
i
=
0
,
j
=
0
;
i
<
geometry
->
u
.
path
.
figure_count
;
++
i
)
...
...
@@ -2819,8 +2819,8 @@ static HRESULT d2d_geometry_resolve_beziers(struct d2d_geometry *geometry)
geometry
->
fill
.
bezier_vertex_count
+=
3
*
geometry
->
u
.
path
.
figures
[
i
].
bezier_control_count
;
}
if
(
!
(
geometry
->
fill
.
bezier_vertices
=
heap_alloc
(
geometry
->
fill
.
bezier_vertex_count
*
sizeof
(
*
geometry
->
fill
.
bezier_vertices
))))
if
(
!
(
geometry
->
fill
.
bezier_vertices
=
d2d_calloc
(
geometry
->
fill
.
bezier_vertex_count
,
sizeof
(
*
geometry
->
fill
.
bezier_vertices
))))
{
ERR
(
"Failed to allocate bezier vertices array.
\n
"
);
geometry
->
fill
.
bezier_vertex_count
=
0
;
...
...
dlls/d2d1/render_target.c
View file @
fdaa6d8e
...
...
@@ -1175,12 +1175,12 @@ static void d2d_rt_draw_glyph_run_bitmap(struct d2d_d3d_render_target *render_ta
if
(
texture_type
==
DWRITE_TEXTURE_CLEARTYPE_3x1
)
bitmap_size
.
width
*=
3
;
opacity_values_size
=
bitmap_size
.
width
*
bitmap_size
.
height
;
if
(
!
(
opacity_values
=
heap_alloc
(
opacity_values_size
)))
if
(
!
(
opacity_values
=
d2d_calloc
(
bitmap_size
.
height
,
bitmap_size
.
width
)))
{
ERR
(
"Failed to allocate opacity values.
\n
"
);
goto
done
;
}
opacity_values_size
=
bitmap_size
.
height
*
bitmap_size
.
width
;
if
(
FAILED
(
hr
=
IDWriteGlyphRunAnalysis_CreateAlphaTexture
(
analysis
,
texture_type
,
&
bounds
,
opacity_values
,
opacity_values_size
)))
...
...
dlls/d2d1/stroke.c
View file @
fdaa6d8e
...
...
@@ -212,7 +212,7 @@ HRESULT d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *fact
if
(
!
dashes
||
!
dash_count
)
return
E_INVALIDARG
;
if
(
!
(
style
->
dashes
=
heap_alloc
(
dash_count
*
sizeof
(
*
style
->
dashes
))))
if
(
!
(
style
->
dashes
=
d2d_calloc
(
dash_count
,
sizeof
(
*
style
->
dashes
))))
return
E_OUTOFMEMORY
;
memcpy
(
style
->
dashes
,
dashes
,
dash_count
*
sizeof
(
*
style
->
dashes
));
style
->
dash_count
=
dash_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