Huw Davies : gdi32: Don' t use the bitfields for the BI_RGB case and also cope with zero masks.

Alexandre Julliard julliard at winehq.org
Tue Apr 12 11:07:38 CDT 2011


Module: wine
Branch: master
Commit: bb28917bc2e1c939edef0a5fb234fa075a509bc4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bb28917bc2e1c939edef0a5fb234fa075a509bc4

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Apr 12 12:49:08 2011 +0100

gdi32: Don't use the bitfields for the BI_RGB case and also cope with zero masks.

---

 dlls/gdi32/dibdrv/dc.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index d784c94..e5048d4 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -40,6 +40,12 @@ static void calc_shift_and_len(DWORD mask, int *shift, int *len)
 {
     int s, l;
 
+    if(!mask)
+    {
+        *shift = *len = 0;
+        return;
+    }
+
     s = 0;
     while ((mask & 1) == 0)
     {
@@ -90,11 +96,16 @@ static BOOL init_dib(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD *bit
     switch(dib->bit_count)
     {
     case 32:
-        init_bit_fields(dib, bit_fields);
-        if(dib->red_mask == 0xff0000 && dib->green_mask == 0x00ff00 && dib->blue_mask == 0x0000ff)
+        if(bi->biCompression == BI_RGB)
             dib->funcs = &funcs_8888;
         else
-            dib->funcs = &funcs_32;
+        {
+            init_bit_fields(dib, bit_fields);
+            if(dib->red_mask == 0xff0000 && dib->green_mask == 0x00ff00 && dib->blue_mask == 0x0000ff)
+                dib->funcs = &funcs_8888;
+            else
+                dib->funcs = &funcs_32;
+        }
         break;
 
     default:




More information about the wine-cvs mailing list