Alexandre Julliard : gdi32: Always use BI_BITFIELDS for 16-bpp in GetImage.

Alexandre Julliard julliard at winehq.org
Fri Aug 5 10:20:48 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Aug  5 12:33:58 2011 +0200

gdi32: Always use BI_BITFIELDS for 16-bpp in GetImage.

---

 dlls/gdi32/bitmap.c       |    8 ++++++++
 dlls/gdi32/dibdrv/dc.c    |   23 ++++++++---------------
 dlls/winex11.drv/bitblt.c |    3 +--
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c
index 69b09ad..8117d6d 100644
--- a/dlls/gdi32/bitmap.c
+++ b/dlls/gdi32/bitmap.c
@@ -67,6 +67,14 @@ DWORD nulldrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
     info->bmiHeader.biYPelsPerMeter = 0;
     info->bmiHeader.biClrUsed       = 0;
     info->bmiHeader.biClrImportant  = 0;
+    if (bmp->bitmap.bmBitsPixel == 16)
+    {
+        DWORD *masks = (DWORD *)info->bmiColors;
+        masks[0] = 0x7c00;
+        masks[1] = 0x03e0;
+        masks[2] = 0x001f;
+        info->bmiHeader.biCompression = BI_BITFIELDS;
+    }
     if (!bits) goto done;
 
     height = src->visrect.bottom - src->visrect.top;
diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 17b2966..b5f4f2b 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -339,6 +339,8 @@ static BOOL dibdrv_DeleteDC( PHYSDEV dev )
 
 static void set_color_info( const dib_info *dib, BITMAPINFO *info )
 {
+    DWORD *masks = (DWORD *)info->bmiColors;
+
     info->bmiHeader.biCompression = BI_RGB;
     info->bmiHeader.biClrUsed     = 0;
 
@@ -355,19 +357,14 @@ static void set_color_info( const dib_info *dib, BITMAPINFO *info )
         }
         break;
     case 16:
-        if (dib->funcs != &funcs_555)
-        {
-            DWORD *masks = (DWORD *)info->bmiColors;
-            masks[0] = dib->red_mask;
-            masks[1] = dib->green_mask;
-            masks[2] = dib->blue_mask;
-            info->bmiHeader.biCompression = BI_BITFIELDS;
-        }
+        masks[0] = dib->red_mask;
+        masks[1] = dib->green_mask;
+        masks[2] = dib->blue_mask;
+        info->bmiHeader.biCompression = BI_BITFIELDS;
         break;
     case 32:
         if (dib->funcs != &funcs_8888)
         {
-            DWORD *masks = (DWORD *)info->bmiColors;
             masks[0] = dib->red_mask;
             masks[1] = dib->green_mask;
             masks[2] = dib->blue_mask;
@@ -417,12 +414,8 @@ static DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
             }
             break;
         case 16:
-            if (bmp->dib->dsBmih.biCompression == BI_BITFIELDS &&
-                memcmp( bmp->dib->dsBitfields, bit_fields_555, sizeof(bmp->dib->dsBitfields) ))
-            {
-                info->bmiHeader.biCompression = BI_BITFIELDS;
-                memcpy( info->bmiColors, bmp->dib->dsBitfields, sizeof(bmp->dib->dsBitfields) );
-            }
+            info->bmiHeader.biCompression = BI_BITFIELDS;
+            memcpy( info->bmiColors, bmp->dib->dsBitfields, sizeof(bmp->dib->dsBitfields) );
             break;
         case 32:
             if (bmp->dib->dsBmih.biCompression == BI_BITFIELDS &&
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index 8d2383a..7f314c2 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -1641,8 +1641,7 @@ static void set_color_info( PHYSDEV dev, const ColorShifts *color_shifts, BITMAP
         colors[0] = color_shifts->logicalRed.max << color_shifts->logicalRed.shift;
         colors[1] = color_shifts->logicalGreen.max << color_shifts->logicalGreen.shift;
         colors[2] = color_shifts->logicalBlue.max << color_shifts->logicalBlue.shift;
-        if (colors[0] != 0x7c00 || colors[1] != 0x03e0 || colors[2] != 0x001f)
-            info->bmiHeader.biCompression = BI_BITFIELDS;
+        info->bmiHeader.biCompression = BI_BITFIELDS;
         break;
     case 32:
         colors[0] = color_shifts->logicalRed.max << color_shifts->logicalRed.shift;




More information about the wine-cvs mailing list