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
1aa35bea
Commit
1aa35bea
authored
Aug 03, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Use GetImage to retrieve the brush bits in enhanced metafiles.
parent
91976a5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
62 deletions
+22
-62
objects.c
dlls/gdi32/enhmfdrv/objects.c
+22
-62
No files found.
dlls/gdi32/enhmfdrv/objects.c
View file @
1aa35bea
...
@@ -105,36 +105,6 @@ HBITMAP EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
...
@@ -105,36 +105,6 @@ HBITMAP EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
}
}
/* Internal helper for EMFDRV_CreateBrushIndirect():
* Change the padding of a bitmap from 16 (BMP) to 32 (DIB) bits.
*/
static
inline
void
EMFDRV_PadTo32
(
LPBYTE
lpRows
,
int
height
,
int
width
)
{
int
bytes16
=
2
*
((
width
+
15
)
/
16
);
int
bytes32
=
4
*
((
width
+
31
)
/
32
);
LPBYTE
lpSrc
,
lpDst
;
int
i
;
if
(
!
height
)
return
;
height
=
abs
(
height
)
-
1
;
lpSrc
=
lpRows
+
height
*
bytes16
;
lpDst
=
lpRows
+
height
*
bytes32
;
/* Note that we work backwards so we can re-pad in place */
while
(
height
>=
0
)
{
for
(
i
=
bytes32
;
i
>
bytes16
;
i
--
)
lpDst
[
i
-
1
]
=
0
;
/* Zero the padding bytes */
for
(;
i
>
0
;
i
--
)
lpDst
[
i
-
1
]
=
lpSrc
[
i
-
1
];
/* Move image bytes into alignment */
lpSrc
-=
bytes16
;
lpDst
-=
bytes32
;
height
--
;
}
}
/***********************************************************************
/***********************************************************************
* EMFDRV_CreateBrushIndirect
* EMFDRV_CreateBrushIndirect
*/
*/
...
@@ -197,46 +167,36 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
...
@@ -197,46 +167,36 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
case
BS_PATTERN
:
case
BS_PATTERN
:
{
{
EMRCREATEDIBPATTERNBRUSHPT
*
emr
;
EMRCREATEDIBPATTERNBRUSHPT
*
emr
;
BITMAPINFOHEADER
*
info
;
char
buffer
[
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
)];
BITMAP
bm
;
BITMAPINFO
*
dst_info
,
*
src_info
=
(
BITMAPINFO
*
)
buffer
;
DWORD
bmSize
,
biSize
,
size
;
struct
gdi_image_bits
bits
;
DWORD
size
;
GetObjectA
((
HANDLE
)
logbrush
.
lbHatch
,
sizeof
(
bm
),
&
bm
);
if
(
!
get_bitmap_image
(
(
HANDLE
)
logbrush
.
lbHatch
,
src_info
,
&
bits
))
break
;
if
(
src_info
->
bmiHeader
.
biBitCount
!=
1
)
if
(
bm
.
bmBitsPixel
!=
1
||
bm
.
bmPlanes
!=
1
)
{
{
FIXME
(
"Trying to create a color pattern brush
\n
"
);
FIXME
(
"Trying to create a color pattern brush
\n
"
);
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
break
;
break
;
}
}
/* BMP will be aligned to 32 bits, not 16 */
bmSize
=
get_dib_stride
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
)
*
bm
.
bmHeight
;
biSize
=
sizeof
(
BITMAPINFOHEADER
);
/* FIXME: There is an extra DWORD written by native before the BMI.
/* FIXME: There is an extra DWORD written by native before the BMI.
* Not sure what its meant to contain.
* Not sure what its meant to contain.
*/
*/
size
=
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
)
+
biSize
+
bmSize
+
sizeof
(
DWORD
);
size
=
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
)
+
sizeof
(
DWORD
)
+
sizeof
(
BITMAPINFOHEADER
)
+
src_info
->
bmiHeader
.
biSizeImage
;
emr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
emr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
emr
)
if
(
!
emr
)
break
;
{
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
info
=
(
BITMAPINFOHEADER
*
)((
LPBYTE
)
emr
+
break
;
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
)
+
sizeof
(
DWORD
));
}
info
->
biSize
=
sizeof
(
BITMAPINFOHEADER
);
info
->
biWidth
=
bm
.
bmWidth
;
dst_info
=
(
BITMAPINFO
*
)((
LPBYTE
)(
emr
+
1
)
+
sizeof
(
DWORD
));
info
->
biHeight
=
bm
.
bmHeight
;
dst_info
->
bmiHeader
=
src_info
->
bmiHeader
;
info
->
biPlanes
=
bm
.
bmPlanes
;
memcpy
(
&
dst_info
->
bmiHeader
+
1
,
bits
.
ptr
,
dst_info
->
bmiHeader
.
biSizeImage
);
info
->
biBitCount
=
bm
.
bmBitsPixel
;
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
info
->
biSizeImage
=
bmSize
;
GetBitmapBits
((
HANDLE
)
logbrush
.
lbHatch
,
bm
.
bmHeight
*
get_bitmap_stride
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
),
(
LPBYTE
)
info
+
sizeof
(
BITMAPINFOHEADER
));
/* Change the padding to be DIB compatible if needed */
if
(
bm
.
bmWidth
&
31
)
EMFDRV_PadTo32
((
LPBYTE
)
info
+
sizeof
(
BITMAPINFOHEADER
),
bm
.
bmWidth
,
bm
.
bmHeight
);
emr
->
emr
.
iType
=
EMR_CREATEMONOBRUSH
;
emr
->
emr
.
iType
=
EMR_CREATEMONOBRUSH
;
emr
->
emr
.
nSize
=
size
;
emr
->
emr
.
nSize
=
size
;
...
@@ -249,10 +209,10 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
...
@@ -249,10 +209,10 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
* FIXME: It may be that the DIB functions themselves accept this value.
* FIXME: It may be that the DIB functions themselves accept this value.
*/
*/
emr
->
iUsage
=
DIB_PAL_MONO
;
emr
->
iUsage
=
DIB_PAL_MONO
;
emr
->
offBmi
=
(
LPBYTE
)
info
-
(
LPBYTE
)
emr
;
emr
->
offBmi
=
(
LPBYTE
)
dst_
info
-
(
LPBYTE
)
emr
;
emr
->
cbBmi
=
biSize
;
emr
->
cbBmi
=
sizeof
(
BITMAPINFOHEADER
)
;
emr
->
offBits
=
emr
->
offBmi
+
biSize
;
emr
->
offBits
=
emr
->
offBmi
+
emr
->
cbBmi
;
emr
->
cbBits
=
bmSiz
e
;
emr
->
cbBits
=
dst_info
->
bmiHeader
.
biSizeImag
e
;
if
(
!
EMFDRV_WriteRecord
(
dev
,
&
emr
->
emr
))
if
(
!
EMFDRV_WriteRecord
(
dev
,
&
emr
->
emr
))
index
=
0
;
index
=
0
;
...
...
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