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
e63b00b1
Commit
e63b00b1
authored
Nov 27, 2023
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/emf: Align and pad bitmap data in EMRSTRETCHDIBITS records.
parent
169a23a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
emfdc.c
dlls/gdi32/emfdc.c
+13
-10
No files found.
dlls/gdi32/emfdc.c
View file @
e63b00b1
...
...
@@ -1899,13 +1899,14 @@ BOOL EMFDC_StretchDIBits( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst,
UINT
bmi_size
,
img_size
,
payload_size
,
emr_size
;
BITMAPINFOHEADER
bih
;
BITMAPINFO
*
bi
;
void
*
ptr
;
/* calculate the size of the colour table and the image */
if
(
!
emf_parse_user_bitmapinfo
(
&
bih
,
&
info
->
bmiHeader
,
usage
,
TRUE
,
&
bmi_size
,
&
img_size
))
return
0
;
/* check for overflows */
payload_size
=
bmi_size
+
img_size
;
payload_size
=
aligned_size
(
bmi_size
)
+
aligned_size
(
img_size
)
;
if
(
payload_size
<
bmi_size
)
return
0
;
emr_size
=
sizeof
(
EMRSTRETCHDIBITS
)
+
payload_size
;
...
...
@@ -1914,14 +1915,6 @@ BOOL EMFDC_StretchDIBits( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst,
/* allocate record */
if
(
!
(
emr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
emr_size
)))
return
0
;
/* write a bitmap info header (with colours) to the record */
bi
=
(
BITMAPINFO
*
)
&
emr
[
1
];
bi
->
bmiHeader
=
bih
;
emf_copy_colours_from_user_bitmapinfo
(
bi
,
info
,
usage
);
/* write bitmap bits to the record */
memcpy
(
(
BYTE
*
)
&
emr
[
1
]
+
bmi_size
,
bits
,
img_size
);
/* fill in the EMR header at the front of our piece of memory */
emr
->
emr
.
iType
=
EMR_STRETCHDIBITS
;
emr
->
emr
.
nSize
=
emr_size
;
...
...
@@ -1937,7 +1930,7 @@ BOOL EMFDC_StretchDIBits( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst,
emr
->
iUsageSrc
=
usage
;
emr
->
offBmiSrc
=
sizeof
(
EMRSTRETCHDIBITS
);
emr
->
cbBmiSrc
=
bmi_size
;
emr
->
offBitsSrc
=
emr
->
offBmiSrc
+
bmi_size
;
emr
->
offBitsSrc
=
emr
->
offBmiSrc
+
aligned_size
(
bmi_size
)
;
emr
->
cbBitsSrc
=
img_size
;
emr
->
cxSrc
=
width_src
;
...
...
@@ -1948,6 +1941,16 @@ BOOL EMFDC_StretchDIBits( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst,
emr
->
rclBounds
.
right
=
x_dst
+
width_dst
-
1
;
emr
->
rclBounds
.
bottom
=
y_dst
+
height_dst
-
1
;
/* write a bitmap info header (with colours) to the record */
bi
=
(
BITMAPINFO
*
)((
BYTE
*
)
emr
+
emr
->
offBmiSrc
);
bi
->
bmiHeader
=
bih
;
emf_copy_colours_from_user_bitmapinfo
(
bi
,
info
,
usage
);
pad_record
(
bi
,
emr
->
cbBmiSrc
);
/* write bitmap bits to the record */
ptr
=
memcpy
(
(
BYTE
*
)
emr
+
emr
->
offBitsSrc
,
bits
,
img_size
);
pad_record
(
ptr
,
emr
->
cbBitsSrc
);
/* save the record we just created */
ret
=
emfdc_record
(
get_dc_emf
(
dc_attr
),
&
emr
->
emr
);
if
(
ret
)
emfdc_update_bounds
(
get_dc_emf
(
dc_attr
),
&
emr
->
rclBounds
);
...
...
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