Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
64f1d97a
Commit
64f1d97a
authored
Jan 18, 2007
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jan 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Some apps pass a color bitmap as a mask to CreateIconIndirect, convert it to b/w.
parent
f3cb4f7d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
8 deletions
+35
-8
cursoricon.c
dlls/user32/cursoricon.c
+35
-8
No files found.
dlls/user32/cursoricon.c
View file @
64f1d97a
...
...
@@ -1823,16 +1823,31 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
HICON16
hObj
;
int
sizeXor
,
sizeAnd
;
if
(
iconinfo
->
hbmColor
)
GetObjectA
(
iconinfo
->
hbmColor
,
sizeof
(
bmpXor
),
&
bmpXor
);
GetObjectA
(
iconinfo
->
hbmMask
,
sizeof
(
bmpAnd
),
&
bmpAnd
);
TRACE
(
"color %p, mask %p, hotspot %ux%u, fIcon %d
\n
"
,
iconinfo
->
hbmColor
,
iconinfo
->
hbmMask
,
iconinfo
->
xHotspot
,
iconinfo
->
yHotspot
,
iconinfo
->
fIcon
);
if
(
iconinfo
->
hbmColor
)
{
GetObjectW
(
iconinfo
->
hbmColor
,
sizeof
(
bmpXor
),
&
bmpXor
);
TRACE
(
"color: width %d, height %d, width bytes %d, planes %u, bpp %u
\n
"
,
bmpXor
.
bmWidth
,
bmpXor
.
bmHeight
,
bmpXor
.
bmWidthBytes
,
bmpXor
.
bmPlanes
,
bmpXor
.
bmBitsPixel
);
}
GetObjectW
(
iconinfo
->
hbmMask
,
sizeof
(
bmpAnd
),
&
bmpAnd
);
TRACE
(
"mask: width %d, height %d, width bytes %d, planes %u, bpp %u
\n
"
,
bmpAnd
.
bmWidth
,
bmpAnd
.
bmHeight
,
bmpAnd
.
bmWidthBytes
,
bmpAnd
.
bmPlanes
,
bmpAnd
.
bmBitsPixel
);
sizeXor
=
iconinfo
->
hbmColor
?
(
bmpXor
.
bmHeight
*
bmpXor
.
bmWidthBytes
)
:
0
;
sizeAnd
=
bmpAnd
.
bmHeight
*
bmpAnd
.
bmWidthBytes
;
sizeAnd
=
bmpAnd
.
bmHeight
*
get_bitmap_width_bytes
(
bmpAnd
.
bmWidth
,
1
)
;
hObj
=
GlobalAlloc16
(
GMEM_MOVEABLE
,
sizeof
(
CURSORICONINFO
)
+
sizeXor
+
sizeAnd
);
if
(
hObj
)
{
HDC
hdc
;
BITMAPINFO
bi
;
CURSORICONINFO
*
info
;
info
=
(
CURSORICONINFO
*
)
GlobalLock16
(
hObj
);
...
...
@@ -1860,15 +1875,27 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
else
{
info
->
nWidth
=
bmpAnd
.
bmWidth
;
info
->
nHeight
=
bmpAnd
.
bmHeight
/
2
;
info
->
nWidthBytes
=
bmpAnd
.
bmWidthBytes
;
info
->
bPlanes
=
bmpAnd
.
bmPlanes
;
info
->
bBitsPerPixel
=
bmpAnd
.
bmBitsPixel
;
info
->
nHeight
=
bmpAnd
.
bmHeight
*
2
;
info
->
nWidthBytes
=
get_bitmap_width_bytes
(
bmpAnd
.
bmWidth
,
1
)
;
info
->
bPlanes
=
1
;
info
->
bBitsPerPixel
=
1
;
}
/* Transfer the bitmap bits to the CURSORICONINFO structure */
GetBitmapBits
(
iconinfo
->
hbmMask
,
sizeAnd
,
(
char
*
)(
info
+
1
)
);
/* Some apps pass a color bitmap as a mask, convert it to b/w */
hdc
=
GetDC
(
0
);
memset
(
&
bi
,
0
,
sizeof
(
bi
)
);
bi
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
bi
.
bmiHeader
.
biWidth
=
bmpAnd
.
bmWidth
;
bi
.
bmiHeader
.
biHeight
=
bmpAnd
.
bmHeight
;
bi
.
bmiHeader
.
biPlanes
=
1
;
bi
.
bmiHeader
.
biBitCount
=
1
;
bi
.
bmiHeader
.
biCompression
=
BI_RGB
;
bi
.
bmiHeader
.
biSizeImage
=
sizeAnd
;
GetDIBits
(
hdc
,
iconinfo
->
hbmMask
,
0
,
bmpAnd
.
bmHeight
,
(
char
*
)(
info
+
1
),
&
bi
,
DIB_RGB_COLORS
);
ReleaseDC
(
0
,
hdc
);
if
(
iconinfo
->
hbmColor
)
GetBitmapBits
(
iconinfo
->
hbmColor
,
sizeXor
,
(
char
*
)(
info
+
1
)
+
sizeAnd
);
GlobalUnlock16
(
hObj
);
}
...
...
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