GDI32: Fix handling of RGB 555/565 in GetDIBits

Felix Nawothnig felix.nawothnig at t-online.de
Fri Aug 19 07:59:04 CDT 2005


A fix for bug #3156. This behaviour is documented at 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_1rw2.asp

ChangeLog:
Fix GetDIBits to retrieve RGB 555 as 16bit BI_RGB and RGB 565 as 16bit 
BI_BITFIELDS.
-------------- next part --------------
Index: dlls/gdi/dib.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/dib.c,v
retrieving revision 1.13
diff -u -p -r1.13 dib.c
--- dlls/gdi/dib.c	8 Aug 2005 18:40:14 -0000	1.13
+++ dlls/gdi/dib.c	19 Aug 2005 12:58:19 -0000
@@ -960,12 +960,30 @@ INT WINAPI GetDIBits(
                 info->bmiHeader.biWidth = bmp->bitmap.bmWidth;
                 info->bmiHeader.biHeight = bmp->bitmap.bmHeight;
                 info->bmiHeader.biPlanes = 1;
-                info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel;
                 info->bmiHeader.biSizeImage =
                                  DIB_GetDIBImageBytes( bmp->bitmap.bmWidth,
                                                        bmp->bitmap.bmHeight,
                                                        bmp->bitmap.bmBitsPixel );
-                info->bmiHeader.biCompression = 0;
+                switch(bmp->bitmap.bmBitsPixel)
+                {
+                case 15:
+                    info->bmiHeader.biBitCount = 16;
+                    info->bmiHeader.biCompression = BI_RGB;
+                    break;
+                    
+                case 16:
+                    info->bmiHeader.biBitCount = 16;
+                    info->bmiHeader.biCompression = BI_BITFIELDS;
+                    ((PDWORD)info->bmiColors)[0] = 0xf800;
+                    ((PDWORD)info->bmiColors)[1] = 0x07e0;
+                    ((PDWORD)info->bmiColors)[2] = 0x001f;
+                    break;
+    
+                default:
+                    info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel;
+                    info->bmiHeader.biCompression = BI_RGB;
+                    break;
+                }
                 info->bmiHeader.biXPelsPerMeter = 0;
                 info->bmiHeader.biYPelsPerMeter = 0;
                 info->bmiHeader.biClrUsed = 0;


More information about the wine-patches mailing list