Huw Davies : winex11.drv: Rename X11DRV_DIB_BitmapInfoSize to bitmap_info_size and fix to take into account bit field masks .
Alexandre Julliard
julliard at winehq.org
Fri May 2 10:09:54 CDT 2008
Module: wine
Branch: master
Commit: 80157c2fa6e914da7c27bc066c2d7343ce3b634a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=80157c2fa6e914da7c27bc066c2d7343ce3b634a
Author: Huw Davies <huw at codeweavers.com>
Date: Fri May 2 12:43:14 2008 +0100
winex11.drv: Rename X11DRV_DIB_BitmapInfoSize to bitmap_info_size and fix to take into account bit field masks.
---
dlls/winex11.drv/brush.c | 2 +-
dlls/winex11.drv/dib.c | 11 ++++++-----
dlls/winex11.drv/x11drv.h | 2 +-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/brush.c b/dlls/winex11.drv/brush.c
index 20f0e52..41e45cd 100644
--- a/dlls/winex11.drv/brush.c
+++ b/dlls/winex11.drv/brush.c
@@ -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,
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 87bd9d1..81345a9 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -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);
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 0033a1f..527f9f5 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -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);
More information about the wine-cvs
mailing list