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
b6f841ea
Commit
b6f841ea
authored
Nov 22, 2009
by
Charles Davis
Committed by
Alexandre Julliard
Nov 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/enhmfdrv: When blitting, don't crash if the source is NULL.
parent
5e17b04d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
4 deletions
+41
-4
bitblt.c
dlls/gdi32/enhmfdrv/bitblt.c
+41
-4
No files found.
dlls/gdi32/enhmfdrv/bitblt.c
View file @
b6f841ea
...
...
@@ -79,10 +79,14 @@ static BOOL EMFDRV_BitBlockTransfer(
UINT
bitsSize
;
UINT
size
;
BITMAP
BM
;
WORD
nBPP
;
WORD
nBPP
=
0
;
LPBITMAPINFOHEADER
lpBmiH
;
BOOL
useSrc
;
EMFDRV_PDEVICE
*
physDevSrc
=
(
EMFDRV_PDEVICE
*
)
devSrc
;
HBITMAP
hBitmap
=
GetCurrentObject
(
physDevSrc
->
hdc
,
OBJ_BITMAP
);
HBITMAP
hBitmap
=
NULL
;
useSrc
=
(((
rop
>>
2
)
&
0x330000
)
!=
(
rop
&
0x330000
));
if
(
!
physDevSrc
&&
useSrc
)
return
FALSE
;
if
(
emrType
==
EMR_BITBLT
)
emrSize
=
sizeof
(
EMRBITBLT
);
...
...
@@ -91,15 +95,24 @@ static BOOL EMFDRV_BitBlockTransfer(
else
return
FALSE
;
if
(
useSrc
)
{
hBitmap
=
GetCurrentObject
(
physDevSrc
->
hdc
,
OBJ_BITMAP
);
if
(
sizeof
(
BITMAP
)
!=
GetObjectW
(
hBitmap
,
sizeof
(
BITMAP
),
&
BM
))
return
FALSE
;
nBPP
=
BM
.
bmPlanes
*
BM
.
bmBitsPixel
;
if
(
nBPP
>
8
)
nBPP
=
24
;
/* FIXME Can't get 16bpp to work for some reason */
bitsSize
=
DIB_GetDIBWidthBytes
(
BM
.
bmWidth
,
nBPP
)
*
BM
.
bmHeight
;
bmiSize
=
sizeof
(
BITMAPINFOHEADER
)
+
(
nBPP
<=
8
?
1
<<
nBPP
:
0
)
*
sizeof
(
RGBQUAD
);
}
else
{
bitsSize
=
bmiSize
=
0
;
}
size
=
emrSize
+
bmiSize
+
bitsSize
;
pEMR
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
...
...
@@ -119,12 +132,28 @@ static BOOL EMFDRV_BitBlockTransfer(
pEMR
->
dwRop
=
rop
;
pEMR
->
xSrc
=
xSrc
;
pEMR
->
ySrc
=
ySrc
;
if
(
useSrc
)
{
GetWorldTransform
(
physDevSrc
->
hdc
,
&
pEMR
->
xformSrc
);
pEMR
->
crBkColorSrc
=
GetBkColor
(
physDevSrc
->
hdc
);
pEMR
->
iUsageSrc
=
DIB_RGB_COLORS
;
pEMR
->
offBmiSrc
=
emrSize
;
pEMR
->
cbBmiSrc
=
bmiSize
;
pEMR
->
offBitsSrc
=
emrSize
+
bmiSize
;
}
else
{
pEMR
->
xformSrc
.
eM11
=
1
.
0
;
/** FIXME: */
pEMR
->
xformSrc
.
eM12
=
0
.
0
;
/** Setting default */
pEMR
->
xformSrc
.
eM21
=
0
.
0
;
/** value. */
pEMR
->
xformSrc
.
eM22
=
1
.
0
;
/** Where should we */
pEMR
->
xformSrc
.
eDx
=
0
.
0
;
/** get that info */
pEMR
->
xformSrc
.
eDy
=
0
.
0
;
/** ???? */
pEMR
->
crBkColorSrc
=
0
;
pEMR
->
iUsageSrc
=
0
;
pEMR
->
offBmiSrc
=
0
;
pEMR
->
offBitsSrc
=
0
;
}
pEMR
->
cbBmiSrc
=
bmiSize
;
pEMR
->
cbBitsSrc
=
bitsSize
;
if
(
emrType
==
EMR_STRETCHBLT
)
{
...
...
@@ -133,6 +162,8 @@ static BOOL EMFDRV_BitBlockTransfer(
pEMRStretch
->
cySrc
=
heightSrc
;
}
if
(
useSrc
)
{
/* Initialize BITMAPINFO structure */
lpBmiH
=
(
LPBITMAPINFOHEADER
)((
BYTE
*
)
pEMR
+
pEMR
->
offBmiSrc
);
...
...
@@ -161,6 +192,12 @@ static BOOL EMFDRV_BitBlockTransfer(
}
else
ret
=
FALSE
;
}
else
{
ret
=
EMFDRV_WriteRecord
(
devDst
,
(
EMR
*
)
pEMR
);
if
(
ret
)
EMFDRV_UpdateBBox
(
devDst
,
&
(
pEMR
->
rclBounds
));
}
HeapFree
(
GetProcessHeap
(),
0
,
pEMR
);
return
ret
;
...
...
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