From be900067b675ff8f80eb8f2b2f796f970f22f1cc Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Fri, 2 May 2008 12:20:24 +0100 Subject: [PATCH] user32: Fix bitmap_info_size to take into account bit field masks. --- dlls/user32/cursoricon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 5dbc1b9225a..c5d192df966 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -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)); } }