Author: tkreuzer
Date: Thu Mar 12 23:55:34 2009
New Revision: 39987
URL:
http://svn.reactos.org/svn/reactos?rev=39987&view=rev
Log:
LoadBitmapImage: - add space for 3 RGBQUADs to BITMAPINFO when biCompression is
BI_BITFIELDS. Based on patch by Evgeniy Boltik <bstsoft at narod dot ru>, modified
by me.
- Take into account BITMAPV4/V5HEADER sizes.
See issue #3708 for more details.
Modified:
trunk/reactos/dll/win32/user32/windows/bitmap.c
Modified: trunk/reactos/dll/win32/user32/windows/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/b…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/bitmap.c [iso-8859-1] Thu Mar 12 23:55:34 2009
@@ -449,18 +449,26 @@
BitmapInfo = (LPBITMAPINFO)((ULONG_PTR)BitmapInfo + sizeof(BITMAPFILEHEADER));
}
- if (BitmapInfo->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
+ HeaderSize = BitmapInfo->bmiHeader.biSize;
+ if (HeaderSize == sizeof(BITMAPCOREHEADER))
{
BITMAPCOREHEADER* Core = (BITMAPCOREHEADER*)BitmapInfo;
ColorCount = (Core->bcBitCount <= 8) ? (1 << Core->bcBitCount) : 0;
- HeaderSize = sizeof(BITMAPCOREHEADER) + ColorCount * sizeof(RGBTRIPLE);
+ HeaderSize += ColorCount * sizeof(RGBTRIPLE);
}
else
{
- ColorCount = BitmapInfo->bmiHeader.biClrUsed;
- if (ColorCount == 0 && BitmapInfo->bmiHeader.biBitCount <= 8)
- ColorCount = 1 << BitmapInfo->bmiHeader.biBitCount;
- HeaderSize = sizeof(BITMAPINFOHEADER) + ColorCount * sizeof(RGBQUAD);
+ if (BitmapInfo->bmiHeader.biCompression == BI_BITFIELDS)
+ {
+ HeaderSize += 3 * sizeof(RGBQUAD);
+ }
+ else
+ {
+ ColorCount = BitmapInfo->bmiHeader.biClrUsed;
+ if (ColorCount == 0 && BitmapInfo->bmiHeader.biBitCount <= 8)
+ ColorCount = 1 << BitmapInfo->bmiHeader.biBitCount;
+ HeaderSize += ColorCount * sizeof(RGBQUAD);
+ }
}
Data = (PVOID)((ULONG_PTR)BitmapInfo + HeaderSize);