Module: wine Branch: master Commit: be900067b675ff8f80eb8f2b2f796f970f22f1cc URL: http://source.winehq.org/git/wine.git/?a=commit;h=be900067b675ff8f80eb8f2b2f...
Author: Huw Davies huw@codeweavers.com Date: Fri May 2 12:20:24 2008 +0100
user32: Fix bitmap_info_size to take into account bit field masks.
---
dlls/user32/cursoricon.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 5dbc1b9..c5d192d 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)); } }