winex11.drv: Rename X11DRV_DIB_BitmapInfoSize to bitmap_info_size and fix to take into account bit field masks.

This commit is contained in:
Huw Davies 2008-05-02 12:43:14 +01:00 committed by Alexandre Julliard
parent 515b40c2de
commit 80157c2fa6
3 changed files with 8 additions and 7 deletions

View 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,

View 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);

View 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);