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
7c479e79
Commit
7c479e79
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 EMRSETDIBITSTODEVICE records.
parent
e63b00b1
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 @
7c479e79
...
...
@@ -1968,6 +1968,7 @@ BOOL EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dst, INT y_dst, DWORD widt
UINT
src_height
,
stride
;
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
,
...
...
@@ -1993,7 +1994,7 @@ BOOL EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dst, INT y_dst, DWORD widt
}
/* 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
(
EMRSETDIBITSTODEVICE
)
+
payload_size
;
...
...
@@ -2002,14 +2003,6 @@ BOOL EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dst, INT y_dst, DWORD widt
/* allocate record */
if
(
!
(
emr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
emr_size
)))
return
FALSE
;
/* 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
);
emr
->
emr
.
iType
=
EMR_SETDIBITSTODEVICE
;
emr
->
emr
.
nSize
=
emr_size
;
emr
->
rclBounds
.
left
=
x_dst
;
...
...
@@ -2024,12 +2017,22 @@ BOOL EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dst, INT y_dst, DWORD widt
emr
->
cySrc
=
height
;
emr
->
offBmiSrc
=
sizeof
(
EMRSETDIBITSTODEVICE
);
emr
->
cbBmiSrc
=
bmi_size
;
emr
->
offBitsSrc
=
sizeof
(
EMRSETDIBITSTODEVICE
)
+
bmi_size
;
emr
->
offBitsSrc
=
sizeof
(
EMRSETDIBITSTODEVICE
)
+
aligned_size
(
bmi_size
)
;
emr
->
cbBitsSrc
=
img_size
;
emr
->
iUsageSrc
=
usage
;
emr
->
iStartScan
=
startscan
;
emr
->
cScans
=
lines
;
/* 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
,
bmi_size
);
/* write bitmap bits to the record */
ptr
=
memcpy
(
(
BYTE
*
)
emr
+
emr
->
offBitsSrc
,
bits
,
img_size
);
pad_record
(
ptr
,
img_size
);
if
((
ret
=
emfdc_record
(
get_dc_emf
(
dc_attr
),
(
EMR
*
)
emr
)))
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