ImageList_SetImageCount should set nCurImage (the number of

images in the list) to the value specified, and expect that
ImageList_ReplaceImage is called to set the new images.
This commit is contained in:
Mike McCormack 2002-08-16 01:35:43 +00:00 committed by Alexandre Julliard
parent c018ef6b6b
commit 5a6a71f39e
1 changed files with 18 additions and 4 deletions

View File

@ -968,8 +968,12 @@ ImageList_Create (INT cx, INT cy, UINT flags,
else
himl->hbmImage = 0;
if ( (himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) {
himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy,
if ( (himl->flags & ILC_MASK)) {
int images = himl->cMaxImage;
if (images <= 0)
images = 1;
himl->hbmMask = CreateBitmap (himl->cx * images, himl->cy,
1, 1, NULL);
if (himl->hbmMask == 0) {
ERR("Error creating mask bitmap!\n");
@ -1409,6 +1413,10 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
/*
Draw the image
*/
TRACE("hbmMask(0x%08x) iImage(%d) x(%d) y(%d) cx(%d) cy(%d)\n",
pimldp->himl->hbmMask, pimldp->i, pimldp->x, pimldp->y, cx, cy);
if(pimldp->himl->hbmMask != 0)
{
IMAGELIST_InternalDrawMask(pimldp, cx, cy);
@ -2428,6 +2436,8 @@ ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage,
HDC hdcImageList, hdcImage;
BITMAP bmp;
TRACE("%p %d %04x %04x\n", himl, i, hbmImage, hbmMask);
if (himl == NULL) {
ERR("Invalid image list handle!\n");
return FALSE;
@ -2796,12 +2806,17 @@ ImageList_SetImageCount (HIMAGELIST himl, INT iImageCount)
HBITMAP hbmNewBitmap;
INT nNewCount, nCopyCount;
TRACE("%p %d\n",himl,iImageCount);
if (!himl)
return FALSE;
if (himl->cCurImage >= iImageCount)
return FALSE;
if (himl->cMaxImage > iImageCount)
{
himl->cCurImage = iImageCount;
return TRUE;
}
nNewCount = iImageCount + himl->cGrow;
nCopyCount = min(himl->cCurImage, iImageCount);
@ -2863,8 +2878,7 @@ ImageList_SetImageCount (HIMAGELIST himl, INT iImageCount)
/* Update max image count and current image count */
himl->cMaxImage = nNewCount;
if (himl->cCurImage > nCopyCount)
himl->cCurImage = nCopyCount;
himl->cCurImage = iImageCount;
return TRUE;
}