user32: Fix bitmap_info_size to take into account bit field masks.

This commit is contained in:
Huw Davies 2008-05-02 12:20:24 +01:00 committed by Alexandre Julliard
parent 652602f5c8
commit be900067b6
1 changed files with 3 additions and 2 deletions

View File

@ -223,7 +223,7 @@ static int get_dib_width_bytes( int width, int depth )
*/
static int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
{
int colors;
int colors, masks = 0;
if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{
@ -239,7 +239,8 @@ static int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
colors = 256;
if (!colors && (info->bmiHeader.biBitCount <= 8))
colors = 1 << info->bmiHeader.biBitCount;
return sizeof(BITMAPINFOHEADER) + colors *
if (info->bmiHeader.biCompression == BI_BITFIELDS) masks = 3;
return sizeof(BITMAPINFOHEADER) + masks * sizeof(DWORD) + colors *
((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD));
}
}