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
7486f47b
Commit
7486f47b
authored
Nov 08, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Nov 08, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Fix a regression in ImageList_AddMasked().
parent
501e2dcc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
54 deletions
+36
-54
imagelist.c
dlls/comctl32/imagelist.c
+36
-54
No files found.
dlls/comctl32/imagelist.c
View file @
7486f47b
...
...
@@ -331,7 +331,7 @@ INT WINAPI
ImageList_AddMasked
(
HIMAGELIST
himl
,
HBITMAP
hBitmap
,
COLORREF
clrMask
)
{
HDC
hdcMask
,
hdcBitmap
;
INT
nIndex
,
nImageCount
;
INT
i
,
nIndex
,
nImageCount
;
BITMAP
bmp
;
HBITMAP
hOldBitmap
;
HBITMAP
hMaskBitmap
=
0
;
...
...
@@ -356,69 +356,51 @@ ImageList_AddMasked (HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
himl
->
cCurImage
+=
nImageCount
;
hdcBitmap
=
CreateCompatibleDC
(
0
);
hOldBitmap
=
SelectObject
(
hdcBitmap
,
hBitmap
);
/* Create a temp Mask so we can remove the background of the Image */
hdcMask
=
CreateCompatibleDC
(
0
);
hMaskBitmap
=
CreateBitmap
(
bmp
.
bmWidth
,
bmp
.
bmHeight
,
1
,
1
,
NULL
);
SelectObject
(
hdcMask
,
hMaskBitmap
);
hOldBitmap
=
SelectObject
(
hdcBitmap
,
hBitmap
);
if
(
himl
->
hbmMask
)
{
hdcMask
=
himl
->
hdcMask
;
imagelist_point_from_index
(
himl
,
nIndex
,
&
pt
);
}
else
{
/*
Create a temp Mask so we can remove the background of
the Image (Windows does this even if there is no mask)
*/
hdcMask
=
CreateCompatibleDC
(
0
);
hMaskBitmap
=
CreateBitmap
(
bmp
.
bmWidth
,
bmp
.
bmHeight
,
1
,
1
,
NULL
);
SelectObject
(
hdcMask
,
hMaskBitmap
);
imagelist_point_from_index
(
himl
,
0
,
&
pt
);
}
/* create monochrome image to the mask bitmap */
bkColor
=
(
clrMask
!=
CLR_DEFAULT
)
?
clrMask
:
GetPixel
(
hdcBitmap
,
0
,
0
);
bkColor
=
(
clrMask
!=
CLR_DEFAULT
)
?
clrMask
:
GetPixel
(
hdcBitmap
,
0
,
0
);
SetBkColor
(
hdcBitmap
,
bkColor
);
BitBlt
(
hdcMask
,
pt
.
x
,
pt
.
y
,
bmp
.
bmWidth
,
bmp
.
bmHeight
,
hdcBitmap
,
0
,
0
,
SRCCOPY
);
BitBlt
(
hdcMask
,
0
,
0
,
bmp
.
bmWidth
,
bmp
.
bmHeight
,
hdcBitmap
,
0
,
0
,
SRCCOPY
);
SetBkColor
(
hdcBitmap
,
RGB
(
255
,
255
,
255
));
/*Remove the background from the image
*/
/*
WINDOWS BUG ALERT!!!!!!
The statement below should not be done in common practice
but this is how ImageList_AddMasked works in Windows.
It overwrites the original bitmap passed, this was discovered
by using the same bitmap to iterate the different styles
on windows where it failed (BUT ImageList_Add is OK)
This is here in case some apps rely on this bug
*/
BitBlt
(
hdcBitmap
,
0
,
0
,
bmp
.
bmWidth
,
bmp
.
bmHeight
,
hdcMask
,
pt
.
x
,
pt
.
y
,
0x220326
);
/* NOTSRCAND */
/* Copy result to the imagelist
*/
imagelist_point_from_index
(
himl
,
nIndex
,
&
pt
);
BitBlt
(
himl
->
hdcImage
,
pt
.
x
,
pt
.
y
,
bmp
.
bmWidth
,
bmp
.
bmHeight
,
hdcBitmap
,
0
,
0
,
SRCCOPY
);
/* Clean up
*/
SelectObject
(
hdcBitmap
,
hOldBitmap
);
DeleteDC
(
hdcBitmap
);
if
(
!
himl
->
hbmMask
)
* Remove the background from the image
*
* WINDOWS BUG ALERT!!!!!!
* The statement below should not be done in common practice
* but this is how ImageList_AddMasked works in Windows.
* It overwrites the original bitmap passed, this was discovered
* by using the same bitmap to iterate the different styles
* on windows where it failed (BUT ImageList_Add is OK)
* This is here in case some apps rely on this bug
*
* Blt mode 0x220326 is NOTSRCAND
*/
BitBlt
(
hdcBitmap
,
0
,
0
,
bmp
.
bmWidth
,
bmp
.
bmHeight
,
hdcMask
,
0
,
0
,
0x220326
);
/* Copy result to the imagelist */
for
(
i
=
0
;
i
<
nImageCount
;
i
++
)
{
DeleteObject
(
hMaskBitmap
);
DeleteDC
(
hdcMask
);
imagelist_point_from_index
(
himl
,
nIndex
+
i
,
&
pt
);
BitBlt
(
himl
->
hdcImage
,
pt
.
x
,
pt
.
y
,
himl
->
cx
,
bmp
.
bmHeight
,
hdcBitmap
,
i
*
himl
->
cx
,
0
,
SRCCOPY
);
BitBlt
(
himl
->
hdcMask
,
pt
.
x
,
pt
.
y
,
himl
->
cx
,
bmp
.
bmHeight
,
hdcMask
,
i
*
himl
->
cx
,
0
,
SRCCOPY
);
}
/* Clean up */
SelectObject
(
hdcBitmap
,
hOldBitmap
);
DeleteDC
(
hdcBitmap
);
DeleteObject
(
hMaskBitmap
);
DeleteDC
(
hdcMask
);
return
nIndex
;
}
...
...
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