Alexandre Julliard : gdi32: Always set biClrUsed in internal BITMAPINFO structures.

Alexandre Julliard julliard at winehq.org
Wed Sep 7 12:35:29 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Sep  7 12:07:15 2011 +0200

gdi32: Always set biClrUsed in internal BITMAPINFO structures.

---

 dlls/gdi32/dib.c           |    5 ++---
 dlls/gdi32/dibdrv/bitblt.c |    1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 57d830d..3739cb7 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -203,6 +203,7 @@ static BOOL bitmapinfo_from_user_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *
                 dst->bmiColors[i].rgbReserved = 0;
             }
         }
+        dst->bmiHeader.biClrUsed = colors;
     }
     return TRUE;
 }
@@ -995,6 +996,7 @@ static void fill_default_color_table( BITMAPINFO *info )
     default:
         ERR("called with bitcount %d\n", info->bmiHeader.biBitCount);
     }
+    info->bmiHeader.biClrUsed = 1 << info->bmiHeader.biBitCount;
 }
 
 void get_ddb_bitmapinfo( BITMAPOBJ *bmp, BITMAPINFO *info )
@@ -1180,10 +1182,7 @@ INT WINAPI GetDIBits(
 
     /* fill out the src colour table, if it needs one */
     if (src_info->bmiHeader.biBitCount <= 8 && src_info->bmiHeader.biClrUsed == 0)
-    {
         fill_default_color_table( src_info );
-        src_info->bmiHeader.biClrUsed = 1 << src_info->bmiHeader.biBitCount;
-    }
 
     /* if the src and dst are the same depth, copy the colour info across */
     if (dst_info->bmiHeader.biBitCount == src_info->bmiHeader.biBitCount && coloruse == DIB_RGB_COLORS )
diff --git a/dlls/gdi32/dibdrv/bitblt.c b/dlls/gdi32/dibdrv/bitblt.c
index 563cb0a..356d276 100644
--- a/dlls/gdi32/dibdrv/bitblt.c
+++ b/dlls/gdi32/dibdrv/bitblt.c
@@ -664,6 +664,7 @@ static BOOL matching_color_info( const dib_info *dib, const BITMAPINFO *info )
     case 8:
     {
         RGBQUAD *color_table = (RGBQUAD *)((char *)info + info->bmiHeader.biSize);
+        if (!info->bmiHeader.biClrUsed) return FALSE;
         if (dib->color_table_size != get_dib_num_of_colors( info )) return FALSE;
         return !memcmp( color_table, dib->color_table, dib->color_table_size * sizeof(RGBQUAD) );
     }




More information about the wine-cvs mailing list