Author: fireball Date: Thu Mar 26 22:46:11 2009 New Revision: 40257
URL: http://svn.reactos.org/svn/reactos?rev=40257&view=rev Log: Apply patch from Wine: http://www.winehq.org/pipermail/wine-patches/2009-March/071155.html
- Fix bitmap size calculation in IMAGELIST_InternalExpandBitmaps and remove unneeded parameter. Memory requirements are greatly reduced after this fix.
See issue #4304 for more details.
Modified: trunk/reactos/dll/win32/comctl32/imagelist.c
Modified: trunk/reactos/dll/win32/comctl32/imagelist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/imagelis... ============================================================================== --- trunk/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] Thu Mar 26 22:46:11 2009 @@ -155,7 +155,7 @@ * This function CANNOT be used to reduce the number of images. */ static void -IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT cy) +IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cy) { HDC hdcBitmap; HBITMAP hbmNewBitmap, hbmNull; @@ -166,15 +166,14 @@ && (himl->cy >= cy)) return;
- if (cx == 0) cx = himl->cx; nNewCount = himl->cCurImage + nImageCount + himl->cGrow;
- imagelist_get_bitmap_size(himl, nNewCount, cx, &sz); + imagelist_get_bitmap_size(himl, nNewCount, himl->cx, &sz);
TRACE("Create expanded bitmaps : himl=%p x=%d y=%d count=%d\n", himl, sz.cx, cy, nNewCount); hdcBitmap = CreateCompatibleDC (0);
- hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, cx); + hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, himl->cx);
if (hbmNewBitmap == 0) ERR("creating new image bitmap (x=%d y=%d)!\n", sz.cx, cy); @@ -248,7 +247,7 @@
nImageCount = bmp.bmWidth / himl->cx;
- IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight); + IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight);
hdcBitmap = CreateCompatibleDC(0);
@@ -350,7 +349,7 @@ else nImageCount = 0;
- IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight); + IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight);
nIndex = himl->cCurImage; himl->cCurImage += nImageCount; @@ -2304,7 +2303,7 @@
if (nIndex == -1) { if (himl->cCurImage + 1 > himl->cMaxImage) - IMAGELIST_InternalExpandBitmaps (himl, 1, 0, 0); + IMAGELIST_InternalExpandBitmaps (himl, 1, 0);
nIndex = himl->cCurImage; himl->cCurImage++;