comctl32: imagelist: Remove more 1xN assumptions.

This commit is contained in:
Mike McCormack 2006-11-02 12:15:50 +09:00 committed by Alexandre Julliard
parent 5f89960a56
commit f97bf3e6e0
1 changed files with 9 additions and 6 deletions

View File

@ -2548,8 +2548,9 @@ ImageList_SetIconSize (HIMAGELIST himl, INT cx, INT cy)
himl->hbmImage = hbmNew; himl->hbmImage = hbmNew;
if (himl->hbmMask) { if (himl->hbmMask) {
hbmNew = CreateBitmap (himl->cMaxImage * himl->cx, himl->cy, SIZE sz;
1, 1, NULL); imagelist_get_bitmap_size(himl, himl->cMaxImage, himl->cy, &sz);
hbmNew = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
SelectObject (himl->hdcMask, hbmNew); SelectObject (himl->hdcMask, hbmNew);
DeleteObject (himl->hbmMask); DeleteObject (himl->hbmMask);
himl->hbmMask = hbmNew; himl->hbmMask = hbmNew;
@ -2847,7 +2848,9 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count, UINT
{ {
HBITMAP hbmNewBitmap; HBITMAP hbmNewBitmap;
UINT ilc = (himl->flags & 0xFE); UINT ilc = (himl->flags & 0xFE);
UINT width = count * himl->cx; SIZE sz;
imagelist_get_bitmap_size( himl, count, height, &sz );
if ((ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32) || ilc == ILC_COLOR) if ((ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32) || ilc == ILC_COLOR)
{ {
@ -2884,8 +2887,8 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count, UINT
} }
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth = width; bmi->bmiHeader.biWidth = sz.cx;
bmi->bmiHeader.biHeight = height; bmi->bmiHeader.biHeight = sz.cy;
bmi->bmiHeader.biPlanes = 1; bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biBitCount = himl->uBitsPixel; bmi->bmiHeader.biBitCount = himl->uBitsPixel;
bmi->bmiHeader.biCompression = BI_RGB; bmi->bmiHeader.biCompression = BI_RGB;
@ -2903,7 +2906,7 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count, UINT
{ {
TRACE("Creating Bitmap: %d Bits per Pixel\n", himl->uBitsPixel); TRACE("Creating Bitmap: %d Bits per Pixel\n", himl->uBitsPixel);
hbmNewBitmap = CreateBitmap (width, height, 1, himl->uBitsPixel, NULL); hbmNewBitmap = CreateBitmap (sz.cx, sz.cy, 1, himl->uBitsPixel, NULL);
} }
TRACE("returning %p\n", hbmNewBitmap); TRACE("returning %p\n", hbmNewBitmap);
return hbmNewBitmap; return hbmNewBitmap;