[PATCH] user32: honor bfOffBits in BITMAP_Load

Wolfram Sang wolfram at the-dreams.de
Tue Apr 6 03:31:38 CDT 2010


Fixes bug #14891 (Bitmaps with offset bits do not display correctly).

Signed-off-by: Wolfram Sang <wolfram at the-dreams.de>
---
 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 fcdb278..82c5d47 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -2490,7 +2490,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name,
     char *bits;
     LONG width, height, new_width, new_height;
     WORD bpp_dummy;
-    DWORD compr_dummy;
+    DWORD compr_dummy, offbits = 0;
     INT bm_type;
     HDC screen_mem_dc = NULL;
 
@@ -2522,6 +2522,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name,
             UnmapViewOfFile( ptr );
             return 0;
         }
+        offbits = bmfh->bfOffBits - sizeof(BITMAPFILEHEADER);
     }
 
     size = bitmap_info_size(info, DIB_RGB_COLORS);
@@ -2564,7 +2565,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name,
     if (!screen_dc) screen_dc = CreateDCW( DISPLAYW, NULL, NULL, NULL );
     if (!(screen_mem_dc = CreateCompatibleDC( screen_dc ))) goto end;
 
-    bits = (char *)info + size;
+    bits = (char *)info + (offbits ?: size);
 
     if (loadflags & LR_CREATEDIBSECTION)
     {
-- 
1.7.0




More information about the wine-patches mailing list