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
cb8ce94e
Commit
cb8ce94e
authored
Feb 27, 2013
by
Daniel Jelinski
Committed by
Alexandre Julliard
Mar 08, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/imagelist: Use proper color format for merged image lists.
parent
a27ecc40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
1 deletion
+70
-1
imagelist.c
dlls/comctl32/imagelist.c
+5
-1
imagelist.c
dlls/comctl32/tests/imagelist.c
+65
-0
No files found.
dlls/comctl32/imagelist.c
View file @
cb8ce94e
...
...
@@ -2082,6 +2082,7 @@ ImageList_Merge (HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2,
INT
cxDst
,
cyDst
;
INT
xOff1
,
yOff1
,
xOff2
,
yOff2
;
POINT
pt1
,
pt2
;
INT
newFlags
;
TRACE
(
"(himl1=%p i1=%d himl2=%p i2=%d dx=%d dy=%d)
\n
"
,
himl1
,
i1
,
himl2
,
i2
,
dx
,
dy
);
...
...
@@ -2121,7 +2122,10 @@ ImageList_Merge (HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2,
yOff2
=
0
;
}
himlDst
=
ImageList_Create
(
cxDst
,
cyDst
,
ILC_MASK
|
ILC_COLOR
,
1
,
1
);
newFlags
=
(
himl1
->
flags
>
himl2
->
flags
?
himl1
->
flags
:
himl2
->
flags
)
&
ILC_COLORDDB
;
if
(
newFlags
==
ILC_COLORDDB
&&
(
himl1
->
flags
&
ILC_COLORDDB
)
==
ILC_COLOR16
)
newFlags
=
ILC_COLOR16
;
/* this is what native (at least v5) does, don't know why */
himlDst
=
ImageList_Create
(
cxDst
,
cyDst
,
ILC_MASK
|
newFlags
,
1
,
1
);
if
(
himlDst
)
{
...
...
dlls/comctl32/tests/imagelist.c
View file @
cb8ce94e
...
...
@@ -492,6 +492,70 @@ static void test_DrawIndirect(void)
DestroyWindow
(
hwndfortest
);
}
static
int
get_color_format
(
HBITMAP
bmp
)
{
BITMAPINFO
bmi
;
HDC
hdc
=
CreateCompatibleDC
(
0
);
HBITMAP
hOldBmp
=
SelectObject
(
hdc
,
bmp
);
int
ret
;
memset
(
&
bmi
,
0
,
sizeof
(
bmi
));
bmi
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
ret
=
GetDIBits
(
hdc
,
bmp
,
0
,
0
,
0
,
&
bmi
,
DIB_RGB_COLORS
);
ok
(
ret
,
"GetDIBits failed
\n
"
);
SelectObject
(
hdc
,
hOldBmp
);
DeleteDC
(
hdc
);
return
bmi
.
bmiHeader
.
biBitCount
;
}
static
void
test_merge_colors
(
void
)
{
HIMAGELIST
himl
[
8
],
hmerge
;
int
sizes
[]
=
{
ILC_COLOR
,
ILC_COLOR
|
ILC_MASK
,
ILC_COLOR4
,
ILC_COLOR8
,
ILC_COLOR16
,
ILC_COLOR24
,
ILC_COLOR32
,
ILC_COLORDDB
};
HICON
hicon1
;
IMAGEINFO
info
;
int
bpp
,
i
,
j
;
hicon1
=
CreateIcon
(
hinst
,
32
,
32
,
1
,
1
,
icon_bits
,
icon_bits
);
ok
(
hicon1
!=
NULL
,
"failed to create hicon1
\n
"
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
himl
[
i
]
=
ImageList_Create
(
32
,
32
,
sizes
[
i
],
0
,
3
);
ok
(
himl
[
i
]
!=
NULL
,
"failed to create himl[%d]
\n
"
,
i
);
ok
(
0
==
ImageList_AddIcon
(
himl
[
i
],
hicon1
),
"add icon1 to himl[%d] failed
\n
"
,
i
);
if
(
i
==
0
||
i
==
1
||
i
==
7
)
{
ImageList_GetImageInfo
(
himl
[
i
],
0
,
&
info
);
sizes
[
i
]
=
get_color_format
(
info
.
hbmImage
);
}
}
DestroyIcon
(
hicon1
);
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
j
=
0
;
j
<
8
;
j
++
)
{
hmerge
=
ImageList_Merge
(
himl
[
i
],
0
,
himl
[
j
],
0
,
0
,
0
);
ok
(
hmerge
!=
NULL
,
"merge himl[%d], himl[%d] failed
\n
"
,
i
,
j
);
ImageList_GetImageInfo
(
hmerge
,
0
,
&
info
);
bpp
=
get_color_format
(
info
.
hbmImage
);
/* ILC_COLOR[X] is defined as [X] */
if
(
i
==
4
&&
j
==
7
)
ok
(
bpp
==
16
,
/* merging ILC_COLOR16 with ILC_COLORDDB seems to be a special case */
"wrong biBitCount %d when merging lists %d (%d) and %d (%d)
\n
"
,
bpp
,
i
,
sizes
[
i
],
j
,
sizes
[
j
]);
else
ok
(
bpp
==
(
i
>
j
?
sizes
[
i
]
:
sizes
[
j
]),
"wrong biBitCount %d when merging lists %d (%d) and %d (%d)
\n
"
,
bpp
,
i
,
sizes
[
i
],
j
,
sizes
[
j
]);
ok
(
info
.
hbmMask
!=
0
,
"Imagelist merged from %d and %d had no mask
\n
"
,
i
,
j
);
if
(
hmerge
)
ImageList_Destroy
(
hmerge
);
}
for
(
i
=
0
;
i
<
8
;
i
++
)
ImageList_Destroy
(
himl
[
i
]);
}
static
void
test_merge
(
void
)
{
HIMAGELIST
himl1
,
himl2
,
hmerge
;
...
...
@@ -2017,6 +2081,7 @@ START_TEST(imagelist)
test_imagecount
();
test_DrawIndirect
();
test_merge
();
test_merge_colors
();
test_imagelist_storage
();
test_iconsize
();
...
...
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