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
d0d98046
Commit
d0d98046
authored
Aug 04, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Create a sanitized BITMAPINFO in StretchDIBits and pass that to the drivers.
parent
7deda051
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
59 deletions
+21
-59
dib.c
dlls/gdi32/dib.c
+10
-11
bitblt.c
dlls/gdi32/enhmfdrv/bitblt.c
+4
-5
bitblt.c
dlls/gdi32/mfdrv/bitblt.c
+2
-3
bitmap.c
dlls/wineps.drv/bitmap.c
+5
-40
No files found.
dlls/gdi32/dib.c
View file @
d0d98046
...
...
@@ -389,9 +389,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
{
DC
*
dc
=
get_nulldrv_dc
(
dev
);
INT
ret
;
LONG
width
,
height
;
WORD
planes
,
bpp
;
DWORD
compr
,
size
;
LONG
height
;
HBITMAP
hBitmap
;
HDC
hdcMem
;
...
...
@@ -399,10 +397,8 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
if
(
GET_DC_PHYSDEV
(
dc
,
pStretchBlt
)
==
dev
||
GET_DC_PHYSDEV
(
dc
,
pPutImage
)
==
dev
)
return
0
;
if
(
DIB_GetBitmapInfo
(
&
info
->
bmiHeader
,
&
width
,
&
height
,
&
planes
,
&
bpp
,
&
compr
,
&
size
)
==
-
1
)
return
0
;
if
(
width
<
0
)
return
0
;
if
(
info
->
bmiHeader
.
biWidth
<
0
)
return
0
;
height
=
info
->
bmiHeader
.
biHeight
;
if
(
xSrc
==
0
&&
ySrc
==
0
&&
widthDst
==
widthSrc
&&
heightDst
==
heightSrc
&&
info
->
bmiHeader
.
biCompression
==
BI_RGB
)
...
...
@@ -417,7 +413,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
hBitmap
=
GetCurrentObject
(
dev
->
hdc
,
OBJ_BITMAP
);
if
(
GetObjectW
(
hBitmap
,
sizeof
(
bm
),
&
bm
)
&&
bm
.
bmWidth
==
widthSrc
&&
bm
.
bmHeight
==
heightSrc
&&
bm
.
bmBitsPixel
==
bpp
&&
bm
.
bmPlanes
==
planes
)
bm
.
bmBitsPixel
==
info
->
bmiHeader
.
biBitCount
&&
bm
.
bmPlanes
==
1
)
{
/* fast path */
return
SetDIBits
(
dev
->
hdc
,
hBitmap
,
0
,
abs
(
height
),
bits
,
info
,
coloruse
);
...
...
@@ -426,7 +422,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
}
hdcMem
=
CreateCompatibleDC
(
dev
->
hdc
);
hBitmap
=
CreateCompatibleBitmap
(
dev
->
hdc
,
w
idth
,
height
);
hBitmap
=
CreateCompatibleBitmap
(
dev
->
hdc
,
info
->
bmiHeader
.
biW
idth
,
height
);
SelectObject
(
hdcMem
,
hBitmap
);
if
(
coloruse
==
DIB_PAL_COLORS
)
SelectPalette
(
hdcMem
,
GetCurrentObject
(
dev
->
hdc
,
OBJ_PAL
),
FALSE
);
...
...
@@ -457,12 +453,15 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
*/
INT
WINAPI
StretchDIBits
(
HDC
hdc
,
INT
xDst
,
INT
yDst
,
INT
widthDst
,
INT
heightDst
,
INT
xSrc
,
INT
ySrc
,
INT
widthSrc
,
INT
heightSrc
,
const
void
*
bits
,
const
BITMAPINFO
*
info
,
UINT
coloruse
,
DWORD
rop
)
const
BITMAPINFO
*
bmi
,
UINT
coloruse
,
DWORD
rop
)
{
char
buffer
[
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
)];
BITMAPINFO
*
info
=
(
BITMAPINFO
*
)
buffer
;
DC
*
dc
;
INT
ret
=
0
;
if
(
!
bits
||
!
info
)
return
0
;
if
(
!
bits
)
return
0
;
if
(
!
bitmapinfo_from_user_bitmapinfo
(
info
,
bmi
,
coloruse
))
return
0
;
if
((
dc
=
get_dc_ptr
(
hdc
)))
{
...
...
dlls/gdi32/enhmfdrv/bitblt.c
View file @
d0d98046
...
...
@@ -175,13 +175,12 @@ INT EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT hei
{
EMRSTRETCHDIBITS
*
emr
;
BOOL
ret
;
UINT
bmi_size
=
0
,
emr_size
;
UINT
bits_size
=
get_dib_image_size
(
info
);
UINT
bmi_size
,
emr_size
;
/* calculate the size of the colour table */
bmi_size
=
bitmap_info_size
(
info
,
wUsage
);
emr_size
=
sizeof
(
EMRSTRETCHDIBITS
)
+
bmi_size
+
bits_siz
e
;
emr_size
=
sizeof
(
EMRSTRETCHDIBITS
)
+
bmi_size
+
info
->
bmiHeader
.
biSizeImag
e
;
emr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
emr_size
);
if
(
!
emr
)
return
0
;
...
...
@@ -189,7 +188,7 @@ INT EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT hei
memcpy
(
&
emr
[
1
],
info
,
bmi_size
);
/* write bitmap bits to the record */
memcpy
(
(
(
BYTE
*
)
(
&
emr
[
1
])
)
+
bmi_size
,
bits
,
bits_siz
e
);
memcpy
(
(
(
BYTE
*
)
(
&
emr
[
1
])
)
+
bmi_size
,
bits
,
info
->
bmiHeader
.
biSizeImag
e
);
/* fill in the EMR header at the front of our piece of memory */
emr
->
emr
.
iType
=
EMR_STRETCHDIBITS
;
...
...
@@ -207,7 +206,7 @@ INT EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT hei
emr
->
offBmiSrc
=
sizeof
(
EMRSTRETCHDIBITS
);
emr
->
cbBmiSrc
=
bmi_size
;
emr
->
offBitsSrc
=
emr
->
offBmiSrc
+
bmi_size
;
emr
->
cbBitsSrc
=
bits_siz
e
;
emr
->
cbBitsSrc
=
info
->
bmiHeader
.
biSizeImag
e
;
emr
->
cxSrc
=
widthSrc
;
emr
->
cySrc
=
heightSrc
;
...
...
dlls/gdi32/mfdrv/bitblt.c
View file @
d0d98046
...
...
@@ -136,8 +136,7 @@ INT MFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
const
BITMAPINFO
*
info
,
UINT
wUsage
,
DWORD
dwRop
)
{
DWORD
infosize
=
bitmap_info_size
(
info
,
wUsage
);
DWORD
imagesize
=
get_dib_image_size
(
info
);
DWORD
len
=
sizeof
(
METARECORD
)
+
10
*
sizeof
(
WORD
)
+
infosize
+
imagesize
;
DWORD
len
=
sizeof
(
METARECORD
)
+
10
*
sizeof
(
WORD
)
+
infosize
+
info
->
bmiHeader
.
biSizeImage
;
METARECORD
*
mr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
!
mr
)
return
0
;
...
...
@@ -155,7 +154,7 @@ INT MFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
mr
->
rdParm
[
9
]
=
(
INT16
)
yDst
;
mr
->
rdParm
[
10
]
=
(
INT16
)
xDst
;
memcpy
(
mr
->
rdParm
+
11
,
info
,
infosize
);
memcpy
(
mr
->
rdParm
+
11
+
infosize
/
2
,
bits
,
i
magesiz
e
);
memcpy
(
mr
->
rdParm
+
11
+
infosize
/
2
,
bits
,
i
nfo
->
bmiHeader
.
biSizeImag
e
);
MFDRV_WriteRecord
(
dev
,
mr
,
mr
->
rdSize
*
2
);
HeapFree
(
GetProcessHeap
(),
0
,
mr
);
return
heightSrc
;
...
...
dlls/wineps.drv/bitmap.c
View file @
d0d98046
...
...
@@ -49,37 +49,6 @@ static inline int get_dib_width_bytes( int width, int depth )
return
4
*
words
;
}
/* get the bitmap info from either an INFOHEADER or COREHEADER bitmap */
static
BOOL
get_bitmap_info
(
const
void
*
ptr
,
LONG
*
width
,
LONG
*
height
,
WORD
*
bpp
,
WORD
*
compr
)
{
const
BITMAPINFOHEADER
*
header
=
ptr
;
switch
(
header
->
biSize
)
{
case
sizeof
(
BITMAPCOREHEADER
):
{
const
BITMAPCOREHEADER
*
core
=
(
const
BITMAPCOREHEADER
*
)
header
;
*
width
=
core
->
bcWidth
;
*
height
=
core
->
bcHeight
;
*
bpp
=
core
->
bcBitCount
;
*
compr
=
0
;
}
return
TRUE
;
case
sizeof
(
BITMAPINFOHEADER
):
case
sizeof
(
BITMAPV4HEADER
):
case
sizeof
(
BITMAPV5HEADER
):
/* V4 and V5 structures are a superset of the INFOHEADER structure */
*
width
=
header
->
biWidth
;
*
height
=
header
->
biHeight
;
*
bpp
=
header
->
biBitCount
;
*
compr
=
header
->
biCompression
;
return
TRUE
;
default:
ERR
(
"(%d): unknown/wrong size for header
\n
"
,
header
->
biSize
);
return
FALSE
;
}
}
/***************************************************************************
* PSDRV_WriteImageHeader
...
...
@@ -336,9 +305,7 @@ INT PSDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
INT
heightDst
,
INT
xSrc
,
INT
ySrc
,
INT
widthSrc
,
INT
heightSrc
,
const
void
*
bits
,
const
BITMAPINFO
*
info
,
UINT
wUsage
,
DWORD
dwRop
)
{
LONG
fullSrcWidth
,
fullSrcHeight
;
INT
stride
;
WORD
bpp
,
compression
;
INT
line
;
POINT
pt
[
2
];
const
BYTE
*
src_ptr
;
...
...
@@ -348,15 +315,13 @@ INT PSDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
TRACE
(
"%p (%d,%d %dx%d) -> (%d,%d %dx%d)
\n
"
,
dev
->
hdc
,
xSrc
,
ySrc
,
widthSrc
,
heightSrc
,
xDst
,
yDst
,
widthDst
,
heightDst
);
if
(
!
get_bitmap_info
(
info
,
&
fullSrcWidth
,
&
fullSrcHeight
,
&
bpp
,
&
compression
))
return
FALSE
;
stride
=
get_dib_width_bytes
(
fullSrcWidth
,
bpp
);
stride
=
get_dib_width_bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
biBitCount
);
TRACE
(
"full size=%dx%d bpp=%d compression=%d rop=%08x
\n
"
,
fullSrc
Width
,
fullSrcHeight
,
bpp
,
c
ompression
,
dwRop
);
TRACE
(
"full size=%dx%d bpp=%d compression=%d rop=%08x
\n
"
,
info
->
bmiHeader
.
bi
Width
,
info
->
bmiHeader
.
biHeight
,
info
->
bmiHeader
.
biBitCount
,
info
->
bmiHeader
.
biC
ompression
,
dwRop
);
if
(
c
ompression
!=
BI_RGB
)
{
if
(
info
->
bmiHeader
.
biC
ompression
!=
BI_RGB
)
{
FIXME
(
"Compression not supported
\n
"
);
return
FALSE
;
}
...
...
@@ -371,7 +336,7 @@ INT PSDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
widthDst
=
pt
[
1
].
x
-
pt
[
0
].
x
;
heightDst
=
pt
[
1
].
y
-
pt
[
0
].
y
;
switch
(
bpp
)
{
switch
(
info
->
bmiHeader
.
biBitCount
)
{
case
1
:
src_ptr
=
bits
;
...
...
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