winex11.drv: Rename X11DRV_DIB_BitmapInfoSize to bitmap_info_size and fix to take...
authorHuw Davies <huw@codeweavers.com>
Fri, 2 May 2008 11:43:14 +0000 (12:43 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 2 May 2008 14:07:50 +0000 (16:07 +0200)
dlls/winex11.drv/brush.c
dlls/winex11.drv/dib.c
dlls/winex11.drv/x11drv.h

index 20f0e5263b65eb6dd4614d81e5b41c90dd4a2ad6..41e45cdc255fee13623baeccbaf0138027c8be6c 100644 (file)
@@ -302,7 +302,7 @@ HBRUSH X11DRV_SelectBrush( X11DRV_PDEVICE *physDev, HBRUSH hbrush )
        TRACE("BS_DIBPATTERN\n");
        if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch )))
        {
-           int size = X11DRV_DIB_BitmapInfoSize( bmpInfo, logbrush.lbColor );
+           int size = bitmap_info_size( bmpInfo, logbrush.lbColor );
            hBitmap = CreateDIBitmap( physDev->hdc, &bmpInfo->bmiHeader,
                                         CBM_INIT, ((char *)bmpInfo) + size,
                                         bmpInfo,
index 87bd9d1c7c4c028694fa6a936592b5e0e293a850..81345a9eed8ff62f414e4f4868f4e23e973b74c0 100644 (file)
@@ -186,13 +186,13 @@ static int X11DRV_DIB_GetDIBImageBytes( int width, int height, int depth )
 
 
 /***********************************************************************
- *           X11DRV_DIB_BitmapInfoSize
+ *           bitmap_info_size
  *
  * Return the size of the bitmap info structure including color table.
  */
-int X11DRV_DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse )
+int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
 {
-    unsigned int colors;
+    unsigned int colors, masks = 0;
 
     if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
     {
@@ -206,7 +206,8 @@ int X11DRV_DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse )
         colors = info->bmiHeader.biClrUsed;
         if (!colors && (info->bmiHeader.biBitCount <= 8))
             colors = 1 << info->bmiHeader.biBitCount;
-        return sizeof(BITMAPINFOHEADER) + colors *
+        if (info->bmiHeader.biCompression == BI_BITFIELDS) masks = 3;
+        return sizeof(BITMAPINFOHEADER) + masks * sizeof(DWORD) + colors *
                ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD));
     }
 }
@@ -4941,7 +4942,7 @@ Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc )
 
     pbmi = GlobalLock(hPackedDIB);
     hBmp = CreateDIBitmap(hdc, &pbmi->bmiHeader, CBM_INIT,
-                          (LPBYTE)pbmi + X11DRV_DIB_BitmapInfoSize( pbmi, DIB_RGB_COLORS ),
+                          (LPBYTE)pbmi + bitmap_info_size( pbmi, DIB_RGB_COLORS ),
                           pbmi, DIB_RGB_COLORS);
     GlobalUnlock(hPackedDIB);
 
index 0033a1f3f524c08f27a7abc038ae7f295ba10520..527f9f52c1d92c16a0ef81d401e496d5c7610172 100644 (file)
@@ -234,7 +234,7 @@ extern void X11DRV_Xcursor_Init(void);
 extern void X11DRV_BITMAP_Init(void);
 extern void X11DRV_FONT_Init( int log_pixels_x, int log_pixels_y );
 
-extern int X11DRV_DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse );
+extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse );
 extern XImage *X11DRV_DIB_CreateXImage( int width, int height, int depth );
 extern HGLOBAL X11DRV_DIB_CreateDIBFromBitmap(HDC hdc, HBITMAP hBmp);
 extern HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc);