imagelist: fix write_bitmap
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Wed Nov 12 09:15:33 CST 2003
Huw Davies <huw at codeweavers.com>
Fix some weird logic in ImageList_Write
--
Huw Davies
huw at codeweavers.com
Index: dlls/comctl32/imagelist.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/imagelist.c,v
retrieving revision 1.80
diff -u -r1.80 imagelist.c
--- dlls/comctl32/imagelist.c 4 Nov 2003 04:22:07 -0000 1.80
+++ dlls/comctl32/imagelist.c 12 Nov 2003 15:12:25 -0000
@@ -450,7 +450,7 @@
ImageList_Copy (HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc,
INT iSrc, UINT uFlags)
{
- TRACE("iDst=%d iSrc=%d\n", iDst, iSrc);
+ TRACE("himlDst=%p iDst=%d himlSrc=%p iSrc=%d\n", himlDst, iDst, himlSrc, iSrc);
if (!is_valid(himlSrc) || !is_valid(himlDst))
return FALSE;
@@ -2650,8 +2650,8 @@
/* XXX is this always correct? */
icount = bm.bmWidth / cx;
- nwidth = cx << 2;
- nheight = cy * ((icount+3)>>2);
+ nwidth = cx;
+ nheight = cy * icount;
bitCount = bm.bmBitsPixel == 1 ? 1 : 24;
sizeImage = ((((bm.bmWidth * bitCount)+31) & ~31) >> 3) * bm.bmHeight;
@@ -2682,13 +2682,13 @@
bmih->biPlanes = 1;
bmih->biBitCount = bitCount;
bmih->biCompression = BI_RGB;
- bmih->biSizeImage = nsizeImage;
+ bmih->biSizeImage = sizeImage;
bmih->biXPelsPerMeter = 0;
bmih->biYPelsPerMeter = 0;
bmih->biClrUsed = 0;
bmih->biClrImportant = 0;
- lpBitsOrg = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, nsizeImage);
+ lpBitsOrg = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, sizeImage);
if(!GetDIBits(xdc, hBitmap, 0, bm.bmHeight, lpBitsOrg,
(BITMAPINFO *)bmih, DIB_RGB_COLORS))
goto failed;
@@ -2706,6 +2706,7 @@
bmih->biWidth = nwidth;
bmih->biHeight = nheight;
+ bmih->biSizeImage = nsizeImage;
if(bitCount == 1) {
/* Hack. */
More information about the wine-patches
mailing list