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
b28c79aa
Commit
b28c79aa
authored
Jan 14, 2005
by
Walt Ogburn
Committed by
Alexandre Julliard
Jan 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix BS_PATTERN brushes in mfdrv. Un-comment the corresponding test.
parent
6847d595
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
11 deletions
+88
-11
objects.c
dlls/gdi/mfdrv/objects.c
+87
-7
metafile.c
dlls/gdi/tests/metafile.c
+1
-4
No files found.
dlls/gdi/mfdrv/objects.c
View file @
b28c79aa
...
...
@@ -126,6 +126,68 @@ HBITMAP MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
return
0
;
}
/***********************************************************************
* Internal helper for MFDRV_CreateBrushIndirect():
* Change the padding of a bitmap from 16 (BMP) to 32 (DIB) bits.
*/
static
inline
void
MFDRV_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
--
;
}
}
/***********************************************************************
* Internal helper for MFDRV_CreateBrushIndirect():
* Reverse order of bitmap rows in going from BMP to DIB.
*/
static
inline
void
MFDRV_Reverse
(
LPBYTE
lpRows
,
int
height
,
int
width
)
{
int
bytes
=
4
*
((
width
+
31
)
/
32
);
LPBYTE
lpSrc
,
lpDst
;
BYTE
temp
;
int
i
;
if
(
!
height
)
return
;
lpSrc
=
lpRows
;
lpDst
=
lpRows
+
(
height
-
1
)
*
bytes
;
height
=
height
/
2
;
while
(
height
>
0
)
{
for
(
i
=
0
;
i
<
bytes
;
i
++
)
{
temp
=
lpDst
[
i
];
lpDst
[
i
]
=
lpSrc
[
i
];
lpSrc
[
i
]
=
temp
;
}
lpSrc
+=
bytes
;
lpDst
-=
bytes
;
height
--
;
}
}
/******************************************************************
* MFDRV_CreateBrushIndirect
...
...
@@ -162,9 +224,9 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush )
case
BS_PATTERN
:
{
BITMAP
bm
;
BYTE
*
bits
;
BITMAPINFO
*
info
;
DWORD
bmSize
;
COLORREF
cref
;
GetObjectA
((
HANDLE
)
logbrush
.
lbHatch
,
sizeof
(
bm
),
&
bm
);
if
(
bm
.
bmBitsPixel
!=
1
||
bm
.
bmPlanes
!=
1
)
{
...
...
@@ -190,12 +252,30 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush )
info
->
bmiHeader
.
biHeight
=
bm
.
bmHeight
;
info
->
bmiHeader
.
biPlanes
=
1
;
info
->
bmiHeader
.
biBitCount
=
1
;
bits
=
((
BYTE
*
)
info
)
+
sizeof
(
BITMAPINFO
)
+
sizeof
(
RGBQUAD
);
GetDIBits
(
physDev
->
hdc
,
(
HANDLE
)
logbrush
.
lbHatch
,
0
,
bm
.
bmHeight
,
bits
,
info
,
DIB_RGB_COLORS
);
*
(
DWORD
*
)
info
->
bmiColors
=
0
;
*
(
DWORD
*
)(
info
->
bmiColors
+
1
)
=
0xffffff
;
info
->
bmiHeader
.
biSizeImage
=
bmSize
;
GetBitmapBits
((
HANDLE
)
logbrush
.
lbHatch
,
bm
.
bmHeight
*
BITMAP_GetWidthBytes
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
),
(
LPBYTE
)
info
+
sizeof
(
BITMAPINFO
)
+
sizeof
(
RGBQUAD
));
/* Change the padding to be DIB compatible if needed */
if
(
bm
.
bmWidth
&
31
)
MFDRV_PadTo32
((
LPBYTE
)
info
+
sizeof
(
BITMAPINFO
)
+
sizeof
(
RGBQUAD
),
bm
.
bmWidth
,
bm
.
bmHeight
);
/* BMP and DIB have opposite row order conventions */
MFDRV_Reverse
((
LPBYTE
)
info
+
sizeof
(
BITMAPINFO
)
+
sizeof
(
RGBQUAD
),
bm
.
bmWidth
,
bm
.
bmHeight
);
cref
=
GetTextColor
(
physDev
->
hdc
);
info
->
bmiColors
[
0
].
rgbRed
=
GetRValue
(
cref
);
info
->
bmiColors
[
0
].
rgbGreen
=
GetGValue
(
cref
);
info
->
bmiColors
[
0
].
rgbBlue
=
GetBValue
(
cref
);
info
->
bmiColors
[
0
].
rgbReserved
=
0
;
cref
=
GetBkColor
(
physDev
->
hdc
);
info
->
bmiColors
[
1
].
rgbRed
=
GetRValue
(
cref
);
info
->
bmiColors
[
1
].
rgbGreen
=
GetGValue
(
cref
);
info
->
bmiColors
[
1
].
rgbBlue
=
GetBValue
(
cref
);
info
->
bmiColors
[
1
].
rgbReserved
=
0
;
break
;
}
...
...
dlls/gdi/tests/metafile.c
View file @
b28c79aa
...
...
@@ -442,8 +442,5 @@ START_TEST(metafile)
/* For win-format metafiles (mfdrv) */
test_mf_Blank
();
test_mf_Graphics
();
/* Crashes under wine: */
/* test_mf_PatternBrush(); */
test_mf_PatternBrush
();
}
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