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
91948f9c
Commit
91948f9c
authored
May 14, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Always alpha blend images for 32-bpp imagelists.
parent
33e7d028
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
imagelist.c
dlls/comctl32/imagelist.c
+21
-13
imagelist.c
dlls/comctl32/tests/imagelist.c
+1
-1
No files found.
dlls/comctl32/imagelist.c
View file @
91948f9c
...
@@ -1142,16 +1142,15 @@ ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y,
...
@@ -1142,16 +1142,15 @@ 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
,
int
alpha
)
int
src_x
,
int
src_y
,
int
cx
,
int
cy
,
BLENDFUNCTION
func
)
{
{
BLENDFUNCTION
func
;
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
HDC
hdc
;
HDC
hdc
;
HBITMAP
bmp
=
0
,
mask
=
0
;
HBITMAP
bmp
=
0
,
mask
=
0
;
BITMAPINFO
*
info
;
BITMAPINFO
*
info
;
void
*
bits
,
*
mask_bits
;
void
*
bits
,
*
mask_bits
;
unsigned
int
*
ptr
;
unsigned
int
*
ptr
;
int
i
,
j
,
has_alpha
=
0
;
int
i
,
j
;
if
(
!
(
hdc
=
CreateCompatibleDC
(
0
)))
return
FALSE
;
if
(
!
(
hdc
=
CreateCompatibleDC
(
0
)))
return
FALSE
;
if
(
!
(
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
))))
goto
done
;
if
(
!
(
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
))))
goto
done
;
...
@@ -1170,8 +1169,6 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
...
@@ -1170,8 +1169,6 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
SelectObject
(
hdc
,
bmp
);
SelectObject
(
hdc
,
bmp
);
BitBlt
(
hdc
,
0
,
0
,
cx
,
cy
,
himl
->
hdcImage
,
src_x
,
src_y
,
SRCCOPY
);
BitBlt
(
hdc
,
0
,
0
,
cx
,
cy
,
himl
->
hdcImage
,
src_x
,
src_y
,
SRCCOPY
);
for
(
i
=
0
,
ptr
=
bits
;
i
<
cx
*
cy
;
i
++
)
if
((
has_alpha
=
(
ptr
[
i
]
&
0xff000000
)
!=
0
))
break
;
if
(
himl
->
hbmMask
)
if
(
himl
->
hbmMask
)
{
{
unsigned
int
width_bytes
=
(
cx
+
31
)
/
32
*
4
;
unsigned
int
width_bytes
=
(
cx
+
31
)
/
32
*
4
;
...
@@ -1186,13 +1183,9 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
...
@@ -1186,13 +1183,9 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
for
(
i
=
0
,
ptr
=
bits
;
i
<
cy
;
i
++
)
for
(
i
=
0
,
ptr
=
bits
;
i
<
cy
;
i
++
)
for
(
j
=
0
;
j
<
cx
;
j
++
,
ptr
++
)
for
(
j
=
0
;
j
<
cx
;
j
++
,
ptr
++
)
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
if
(
!
has_alpha
)
*
ptr
|=
0xff000000
;
else
*
ptr
|=
0xff000000
;
}
}
func
.
BlendOp
=
AC_SRC_OVER
;
func
.
BlendFlags
=
0
;
func
.
SourceConstantAlpha
=
alpha
;
func
.
AlphaFormat
=
AC_SRC_ALPHA
;
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
);
done:
done:
...
@@ -1229,6 +1222,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
...
@@ -1229,6 +1222,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
HIMAGELIST
himl
;
HIMAGELIST
himl
;
HBRUSH
hOldBrush
;
HBRUSH
hOldBrush
;
POINT
pt
;
POINT
pt
;
BOOL
has_alpha
;
if
(
!
pimldp
||
!
(
himl
=
pimldp
->
himl
))
return
FALSE
;
if
(
!
pimldp
||
!
(
himl
=
pimldp
->
himl
))
return
FALSE
;
if
(
!
is_valid
(
himl
))
return
FALSE
;
if
(
!
is_valid
(
himl
))
return
FALSE
;
...
@@ -1278,14 +1272,25 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
...
@@ -1278,14 +1272,25 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
oldImageFg
=
SetTextColor
(
hImageDC
,
RGB
(
0
,
0
,
0
)
);
oldImageFg
=
SetTextColor
(
hImageDC
,
RGB
(
0
,
0
,
0
)
);
oldImageBk
=
SetBkColor
(
hImageDC
,
RGB
(
0xff
,
0xff
,
0xff
)
);
oldImageBk
=
SetBkColor
(
hImageDC
,
RGB
(
0xff
,
0xff
,
0xff
)
);
if
(
fState
&
ILS_ALPHA
)
has_alpha
=
(
himl
->
has_alpha
&&
himl
->
has_alpha
[
pimldp
->
i
]);
if
(
!
bMask
&&
(
has_alpha
||
(
fState
&
ILS_ALPHA
)))
{
{
COLORREF
colour
;
COLORREF
colour
;
BLENDFUNCTION
func
;
func
.
BlendOp
=
AC_SRC_OVER
;
func
.
BlendFlags
=
0
;
func
.
SourceConstantAlpha
=
(
fState
&
ILS_ALPHA
)
?
pimldp
->
Frame
:
255
;
func
.
AlphaFormat
=
AC_SRC_ALPHA
;
if
(
bIsTransparent
)
if
(
bIsTransparent
)
{
{
if
(
himl
->
uBitsPixel
==
32
)
/* we already have an alpha channel in this case */
bResult
=
GdiAlphaBlend
(
pimldp
->
hdcDst
,
pimldp
->
x
,
pimldp
->
y
,
cx
,
cy
,
himl
->
hdcImage
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
);
else
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
,
pimldp
->
Frame
);
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
);
goto
end
;
goto
end
;
}
}
colour
=
pimldp
->
rgbBk
;
colour
=
pimldp
->
rgbBk
;
...
@@ -1294,7 +1299,10 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
...
@@ -1294,7 +1299,10 @@ 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
,
pimldp
->
Frame
);
if
(
himl
->
uBitsPixel
==
32
)
GdiAlphaBlend
(
hImageDC
,
0
,
0
,
cx
,
cy
,
himl
->
hdcImage
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
);
else
alpha_blend_image
(
himl
,
hImageDC
,
0
,
0
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
);
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 @
91948f9c
...
@@ -1201,7 +1201,7 @@ static void test_ImageList_DrawIndirect(void)
...
@@ -1201,7 +1201,7 @@ static void test_ImageList_DrawIndirect(void)
check_ImageList_DrawIndirect_fStyle
(
hdcDst
,
himl
,
bits
,
iAlphaImage
,
ILD_PRESERVEALPHA
,
0x005D6F81
,
__LINE__
);
check_ImageList_DrawIndirect_fStyle
(
hdcDst
,
himl
,
bits
,
iAlphaImage
,
ILD_PRESERVEALPHA
,
0x005D6F81
,
__LINE__
);
}
}
todo_wine
check_ImageList_DrawIndirect_fStyle
(
hdcDst
,
himl
,
bits
,
iTransparentImage
,
ILD_NORMAL
,
0x00FFFFFF
,
__LINE__
);
check_ImageList_DrawIndirect_fStyle
(
hdcDst
,
himl
,
bits
,
iTransparentImage
,
ILD_NORMAL
,
0x00FFFFFF
,
__LINE__
);
check_ImageList_DrawIndirect_ILD_ROP
(
hdcDst
,
himl
,
bits
,
iImage
,
SRCCOPY
,
0x00ABCDEF
,
__LINE__
);
check_ImageList_DrawIndirect_ILD_ROP
(
hdcDst
,
himl
,
bits
,
iImage
,
SRCCOPY
,
0x00ABCDEF
,
__LINE__
);
check_ImageList_DrawIndirect_ILD_ROP
(
hdcDst
,
himl
,
bits
,
iImage
,
SRCINVERT
,
0x00543210
,
__LINE__
);
check_ImageList_DrawIndirect_ILD_ROP
(
hdcDst
,
himl
,
bits
,
iImage
,
SRCINVERT
,
0x00543210
,
__LINE__
);
...
...
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