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
ff71cc2c
Commit
ff71cc2c
authored
Jan 11, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Fix management of imagelist growth amount.
parent
72a7c341
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
10 deletions
+64
-10
imagelist.c
dlls/comctl32/imagelist.c
+11
-10
imagelist.c
dlls/comctl32/tests/imagelist.c
+53
-0
No files found.
dlls/comctl32/imagelist.c
View file @
ff71cc2c
...
@@ -771,7 +771,14 @@ ImageList_Create (INT cx, INT cy, UINT flags,
...
@@ -771,7 +771,14 @@ ImageList_Create (INT cx, INT cy, UINT flags,
if
(
FAILED
(
ImageListImpl_CreateInstance
(
NULL
,
&
IID_IImageList
,
(
void
**
)
&
himl
)))
if
(
FAILED
(
ImageListImpl_CreateInstance
(
NULL
,
&
IID_IImageList
,
(
void
**
)
&
himl
)))
return
NULL
;
return
NULL
;
cGrow
=
(
cGrow
<
4
)
?
4
:
(
cGrow
+
3
)
&
~
3
;
cGrow
=
(
WORD
)((
max
(
cGrow
,
1
)
+
3
)
&
~
3
);
if
(
cGrow
>
256
)
{
/* Windows doesn't limit the size here, but X11 doesn't let use allocate such huge bitmaps */
WARN
(
"grow %d too large, limiting to 256
\n
"
,
cGrow
);
cGrow
=
256
;
}
himl
->
cx
=
cx
;
himl
->
cx
=
cx
;
himl
->
cy
=
cy
;
himl
->
cy
=
cy
;
...
@@ -2352,7 +2359,7 @@ ImageList_Remove (HIMAGELIST himl, INT i)
...
@@ -2352,7 +2359,7 @@ ImageList_Remove (HIMAGELIST himl, INT i)
return
TRUE
;
return
TRUE
;
}
}
himl
->
cMaxImage
=
himl
->
c
Initial
+
himl
->
cGrow
-
1
;
himl
->
cMaxImage
=
himl
->
c
Grow
;
himl
->
cCurImage
=
0
;
himl
->
cCurImage
=
0
;
for
(
nCount
=
0
;
nCount
<
MAX_OVERLAYIMAGE
;
nCount
++
)
for
(
nCount
=
0
;
nCount
<
MAX_OVERLAYIMAGE
;
nCount
++
)
himl
->
nOvlIdx
[
nCount
]
=
-
1
;
himl
->
nOvlIdx
[
nCount
]
=
-
1
;
...
@@ -2563,7 +2570,7 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon)
...
@@ -2563,7 +2570,7 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon)
return
-
1
;
return
-
1
;
if
(
nIndex
==
-
1
)
{
if
(
nIndex
==
-
1
)
{
if
(
himl
->
cCurImage
+
1
>
himl
->
cMaxImage
)
if
(
himl
->
cCurImage
+
1
>
=
himl
->
cMaxImage
)
IMAGELIST_InternalExpandBitmaps
(
himl
,
1
);
IMAGELIST_InternalExpandBitmaps
(
himl
,
1
);
nIndex
=
himl
->
cCurImage
;
nIndex
=
himl
->
cCurImage
;
...
@@ -2848,14 +2855,8 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
...
@@ -2848,14 +2855,8 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
if
(
!
is_valid
(
himl
))
if
(
!
is_valid
(
himl
))
return
FALSE
;
return
FALSE
;
if
(
himl
->
cMaxImage
>
iImageCount
)
{
himl
->
cCurImage
=
iImageCount
;
/* TODO: shrink the bitmap when cMaxImage-cCurImage>cGrow ? */
return
TRUE
;
}
nNewCount
=
iImageCount
+
himl
->
cGrow
;
nNewCount
=
iImageCount
+
1
;
nCopyCount
=
min
(
himl
->
cCurImage
,
iImageCount
);
nCopyCount
=
min
(
himl
->
cCurImage
,
iImageCount
);
hdcBitmap
=
CreateCompatibleDC
(
0
);
hdcBitmap
=
CreateCompatibleDC
(
0
);
...
...
dlls/comctl32/tests/imagelist.c
View file @
ff71cc2c
...
@@ -1089,6 +1089,59 @@ static void test_imagelist_storage(void)
...
@@ -1089,6 +1089,59 @@ static void test_imagelist_storage(void)
ret
=
ImageList_Destroy
(
himl
);
ret
=
ImageList_Destroy
(
himl
);
ok
(
ret
,
"ImageList_Destroy failed
\n
"
);
ok
(
ret
,
"ImageList_Destroy failed
\n
"
);
iml_clear_stream_data
();
iml_clear_stream_data
();
himl
=
ImageList_Create
(
BMP_CX
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
2
,
99
);
ok
(
himl
!=
0
,
"ImageList_Create failed
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
0
,
3
,
100
,
BMP_CX
*
4
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 99"
);
icon
=
CreateIcon
(
hinst
,
32
,
32
,
1
,
1
,
icon_bits
,
icon_bits
);
ok
(
ImageList_AddIcon
(
himl
,
icon
)
==
0
,
"failed to add icon
\n
"
);
ok
(
ImageList_AddIcon
(
himl
,
icon
)
==
1
,
"failed to add icon
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
2
,
3
,
100
,
BMP_CX
*
4
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 99 2 icons"
);
ok
(
ImageList_AddIcon
(
himl
,
icon
)
==
2
,
"failed to add icon
\n
"
);
DestroyIcon
(
icon
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
3
,
104
,
100
,
BMP_CX
*
4
,
BMP_CX
*
104
/
4
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 99 3 icons"
);
ok
(
ImageList_Remove
(
himl
,
-
1
)
==
TRUE
,
"failed to remove icon
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
0
,
100
,
100
,
BMP_CX
*
4
,
BMP_CX
*
100
/
4
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 99 empty"
);
ok
(
ImageList_SetImageCount
(
himl
,
22
)
==
TRUE
,
"failed to set image count
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
22
,
23
,
100
,
BMP_CX
*
4
,
BMP_CX
*
24
/
4
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 99 set count 22"
);
ok
(
ImageList_SetImageCount
(
himl
,
0
)
==
TRUE
,
"failed to set image count
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
0
,
1
,
100
,
BMP_CX
*
4
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 99 set count 0"
);
ok
(
ImageList_SetImageCount
(
himl
,
42
)
==
TRUE
,
"failed to set image count
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
42
,
43
,
100
,
BMP_CX
*
4
,
BMP_CX
*
44
/
4
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 99 set count 42"
);
ret
=
ImageList_Destroy
(
himl
);
ok
(
ret
,
"ImageList_Destroy failed
\n
"
);
iml_clear_stream_data
();
himl
=
ImageList_Create
(
BMP_CX
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
2
,
65536
+
12
);
ok
(
himl
!=
0
,
"ImageList_Create failed
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
0
,
3
,
12
,
BMP_CX
*
4
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 65536+12"
);
ret
=
ImageList_Destroy
(
himl
);
ok
(
ret
,
"ImageList_Destroy failed
\n
"
);
iml_clear_stream_data
();
himl
=
ImageList_Create
(
BMP_CX
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
2
,
65535
);
ok
(
himl
!=
0
,
"ImageList_Create failed
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
0
,
3
,
0
,
BMP_CX
*
4
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow 65535"
);
ret
=
ImageList_Destroy
(
himl
);
ok
(
ret
,
"ImageList_Destroy failed
\n
"
);
iml_clear_stream_data
();
himl
=
ImageList_Create
(
BMP_CX
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
2
,
-
20
);
ok
(
himl
!=
0
,
"ImageList_Create failed
\n
"
);
check_iml_data
(
himl
,
BMP_CX
,
BMP_CX
,
0
,
3
,
4
,
BMP_CX
*
4
,
BMP_CX
,
ILC_COLOR4
|
ILC_MASK
,
"init 2 grow -20"
);
ret
=
ImageList_Destroy
(
himl
);
ok
(
ret
,
"ImageList_Destroy failed
\n
"
);
iml_clear_stream_data
();
}
}
static
void
test_shell_imagelist
(
void
)
static
void
test_shell_imagelist
(
void
)
...
...
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