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
61b92092
Commit
61b92092
authored
Mar 02, 2020
by
Ziqing Hui
Committed by
Alexandre Julliard
Mar 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/imagelist: Correctly handle alpha channel of 32bpp image.
Signed-off-by:
Ziqing Hui
<
zhui@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5784343d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
16 deletions
+10
-16
imagelist.c
dlls/comctl32/imagelist.c
+10
-14
imagelist.c
dlls/comctl32/tests/imagelist.c
+0
-2
No files found.
dlls/comctl32/imagelist.c
View file @
61b92092
...
@@ -215,16 +215,7 @@ static void add_dib_bits( HIMAGELIST himl, int pos, int count, int width, int he
...
@@ -215,16 +215,7 @@ static void add_dib_bits( HIMAGELIST himl, int pos, int count, int width, int he
for
(
j
=
n
*
width
;
j
<
(
n
+
1
)
*
width
;
j
++
)
for
(
j
=
n
*
width
;
j
<
(
n
+
1
)
*
width
;
j
++
)
if
((
has_alpha
=
((
bits
[
i
*
stride
+
j
]
&
0xff000000
)
!=
0
)))
break
;
if
((
has_alpha
=
((
bits
[
i
*
stride
+
j
]
&
0xff000000
)
!=
0
)))
break
;
if
(
!
has_alpha
)
/* generate alpha channel from the mask */
if
(
has_alpha
)
{
for
(
i
=
0
;
i
<
height
;
i
++
)
for
(
j
=
n
*
width
;
j
<
(
n
+
1
)
*
width
;
j
++
)
if
(
!
mask_info
||
!
((
mask_bits
[
i
*
mask_stride
+
j
/
8
]
<<
(
j
%
8
))
&
0x80
))
bits
[
i
*
stride
+
j
]
|=
0xff000000
;
else
bits
[
i
*
stride
+
j
]
=
0
;
}
else
{
{
himl
->
has_alpha
[
pos
+
n
]
=
1
;
himl
->
has_alpha
[
pos
+
n
]
=
1
;
...
@@ -1251,7 +1242,7 @@ ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y,
...
@@ -1251,7 +1242,7 @@ ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y,
static
BOOL
alpha_blend_image
(
HIMAGELIST
himl
,
HDC
dest_dc
,
int
dest_x
,
int
dest_y
,
static
BOOL
alpha_blend_image
(
HIMAGELIST
himl
,
HDC
dest_dc
,
int
dest_x
,
int
dest_y
,
int
src_x
,
int
src_y
,
int
cx
,
int
cy
,
BLENDFUNCTION
func
,
int
src_x
,
int
src_y
,
int
cx
,
int
cy
,
BLENDFUNCTION
func
,
UINT
style
,
COLORREF
blend_col
)
UINT
style
,
COLORREF
blend_col
,
BOOL
has_alpha
)
{
{
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
HDC
hdc
;
HDC
hdc
;
...
@@ -1302,7 +1293,7 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
...
@@ -1302,7 +1293,7 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
}
}
}
}
if
(
h
iml
->
h
as_alpha
)
/* we already have an alpha channel in this case */
if
(
has_alpha
)
/* we already have an alpha channel in this case */
{
{
/* pre-multiply by the alpha channel */
/* pre-multiply by the alpha channel */
for
(
i
=
0
,
ptr
=
bits
;
i
<
cx
*
cy
;
i
++
,
ptr
++
)
for
(
i
=
0
,
ptr
=
bits
;
i
<
cx
*
cy
;
i
++
,
ptr
++
)
...
@@ -1338,6 +1329,11 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
...
@@ -1338,6 +1329,11 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
if
((((
BYTE
*
)
mask_bits
)[
i
*
width_bytes
+
j
/
8
]
<<
(
j
%
8
))
&
0x80
)
*
ptr
=
0
;
if
((((
BYTE
*
)
mask_bits
)[
i
*
width_bytes
+
j
/
8
]
<<
(
j
%
8
))
&
0x80
)
*
ptr
=
0
;
else
*
ptr
|=
0xff000000
;
else
*
ptr
|=
0xff000000
;
}
}
else
{
for
(
i
=
0
,
ptr
=
bits
;
i
<
cx
*
cy
;
i
++
,
ptr
++
)
*
ptr
|=
0xff000000
;
}
ret
=
GdiAlphaBlend
(
dest_dc
,
dest_x
,
dest_y
,
cx
,
cy
,
hdc
,
0
,
0
,
cx
,
cy
,
func
);
ret
=
GdiAlphaBlend
(
dest_dc
,
dest_x
,
dest_y
,
cx
,
cy
,
hdc
,
0
,
0
,
cx
,
cy
,
func
);
...
@@ -1446,7 +1442,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
...
@@ -1446,7 +1442,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
if
(
bIsTransparent
)
if
(
bIsTransparent
)
{
{
bResult
=
alpha_blend_image
(
himl
,
pimldp
->
hdcDst
,
pimldp
->
x
,
pimldp
->
y
,
bResult
=
alpha_blend_image
(
himl
,
pimldp
->
hdcDst
,
pimldp
->
x
,
pimldp
->
y
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
,
fStyle
,
blend_col
);
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
,
fStyle
,
blend_col
,
has_alpha
);
goto
end
;
goto
end
;
}
}
colour
=
pimldp
->
rgbBk
;
colour
=
pimldp
->
rgbBk
;
...
@@ -1455,7 +1451,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
...
@@ -1455,7 +1451,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
hOldBrush
=
SelectObject
(
hImageDC
,
CreateSolidBrush
(
colour
));
hOldBrush
=
SelectObject
(
hImageDC
,
CreateSolidBrush
(
colour
));
PatBlt
(
hImageDC
,
0
,
0
,
cx
,
cy
,
PATCOPY
);
PatBlt
(
hImageDC
,
0
,
0
,
cx
,
cy
,
PATCOPY
);
alpha_blend_image
(
himl
,
hImageDC
,
0
,
0
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
,
fStyle
,
blend_col
);
alpha_blend_image
(
himl
,
hImageDC
,
0
,
0
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
,
fStyle
,
blend_col
,
has_alpha
);
DeleteObject
(
SelectObject
(
hImageDC
,
hOldBrush
));
DeleteObject
(
SelectObject
(
hImageDC
,
hOldBrush
));
bResult
=
BitBlt
(
pimldp
->
hdcDst
,
pimldp
->
x
,
pimldp
->
y
,
cx
,
cy
,
hImageDC
,
0
,
0
,
SRCCOPY
);
bResult
=
BitBlt
(
pimldp
->
hdcDst
,
pimldp
->
x
,
pimldp
->
y
,
cx
,
cy
,
hImageDC
,
0
,
0
,
SRCCOPY
);
goto
end
;
goto
end
;
...
...
dlls/comctl32/tests/imagelist.c
View file @
61b92092
...
@@ -2316,8 +2316,6 @@ static void test_alpha(void)
...
@@ -2316,8 +2316,6 @@ static void test_alpha(void)
DeleteObject
(
hbm_test
);
DeleteObject
(
hbm_test
);
get_image_alpha
(
himl
,
i
/
2
,
2
,
1
,
alpha
);
get_image_alpha
(
himl
,
i
/
2
,
2
,
1
,
alpha
);
todo_wine_if
(
i
==
0
)
ok
(
alpha
[
0
]
==
GetAValue
(
test_bitmaps
[
i
])
&&
alpha
[
1
]
==
GetAValue
(
test_bitmaps
[
i
+
1
]),
ok
(
alpha
[
0
]
==
GetAValue
(
test_bitmaps
[
i
])
&&
alpha
[
1
]
==
GetAValue
(
test_bitmaps
[
i
+
1
]),
"Bitmap [%08X, %08X] returned alpha value [%02X, %02X], expected [%02X, %02X]
\n
"
,
"Bitmap [%08X, %08X] returned alpha value [%02X, %02X], expected [%02X, %02X]
\n
"
,
test_bitmaps
[
i
],
test_bitmaps
[
i
+
1
],
alpha
[
0
],
alpha
[
1
],
test_bitmaps
[
i
],
test_bitmaps
[
i
+
1
],
alpha
[
0
],
alpha
[
1
],
...
...
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