mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
gdi32: Rename DIB_BitmapInfoSize to bitmap_info_size and fix to take into account bit field masks.
This commit is contained in:
parent
be900067b6
commit
515b40c2de
@ -67,7 +67,7 @@ static HGLOBAL16 dib_copy(const BITMAPINFO *info, UINT coloruse)
|
||||
size = DIB_GetDIBImageBytes(info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount);
|
||||
size += DIB_BitmapInfoSize( info, coloruse );
|
||||
size += bitmap_info_size( info, coloruse );
|
||||
|
||||
if (!(hmem = GlobalAlloc16( GMEM_MOVEABLE, size )))
|
||||
{
|
||||
|
@ -117,13 +117,13 @@ int DIB_GetDIBImageBytes( int width, int height, int depth )
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DIB_BitmapInfoSize
|
||||
* bitmap_info_size
|
||||
*
|
||||
* Return the size of the bitmap info structure including color table.
|
||||
*/
|
||||
int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse )
|
||||
int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
|
||||
{
|
||||
int colors;
|
||||
int colors, masks = 0;
|
||||
|
||||
if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||
{
|
||||
@ -138,7 +138,8 @@ int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse )
|
||||
if (colors > 256) colors = 256;
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ INT EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
|
||||
info->bmiHeader.biBitCount);
|
||||
|
||||
/* calculate the size of the colour table */
|
||||
bmi_size = DIB_BitmapInfoSize(info, wUsage);
|
||||
bmi_size = bitmap_info_size(info, wUsage);
|
||||
|
||||
emr_size = sizeof (EMRSTRETCHDIBITS) + bmi_size + bits_size;
|
||||
emr = HeapAlloc(GetProcessHeap(), 0, emr_size );
|
||||
@ -262,7 +262,7 @@ INT EMFDRV_SetDIBitsToDevice(
|
||||
EMRSETDIBITSTODEVICE* pEMR;
|
||||
DWORD size, bmiSize, bitsSize;
|
||||
|
||||
bmiSize = DIB_BitmapInfoSize(info, wUsage);
|
||||
bmiSize = bitmap_info_size(info, wUsage);
|
||||
bitsSize = DIB_GetDIBImageBytes( info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount );
|
||||
|
@ -174,7 +174,7 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
|
||||
bmSize = DIB_GetDIBImageBytes(info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount);
|
||||
biSize = DIB_BitmapInfoSize(info, LOWORD(logbrush.lbColor));
|
||||
biSize = bitmap_info_size(info, LOWORD(logbrush.lbColor));
|
||||
size = sizeof(EMRCREATEDIBPATTERNBRUSHPT) + biSize + bmSize;
|
||||
emr = HeapAlloc( GetProcessHeap(), 0, size );
|
||||
if(!emr) break;
|
||||
|
@ -408,7 +408,7 @@ extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;
|
||||
/* dib.c */
|
||||
extern int DIB_GetDIBWidthBytes( int width, int depth ) DECLSPEC_HIDDEN;
|
||||
extern int DIB_GetDIBImageBytes( int width, int height, int depth ) DECLSPEC_HIDDEN;
|
||||
extern int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
|
||||
extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* driver.c */
|
||||
extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN;
|
||||
|
@ -889,7 +889,7 @@ BOOL WINAPI PlayMetaFileRecord( HDC hdc, HANDLETABLE *ht, METARECORD *mr, UINT
|
||||
case META_STRETCHDIB:
|
||||
{
|
||||
LPBITMAPINFO info = (LPBITMAPINFO) &(mr->rdParm[11]);
|
||||
LPSTR bits = (LPSTR)info + DIB_BitmapInfoSize( info, mr->rdParm[2] );
|
||||
LPSTR bits = (LPSTR)info + bitmap_info_size( info, mr->rdParm[2] );
|
||||
StretchDIBits( hdc, (SHORT)mr->rdParm[10], (SHORT)mr->rdParm[9], (SHORT)mr->rdParm[8],
|
||||
(SHORT)mr->rdParm[7], (SHORT)mr->rdParm[6], (SHORT)mr->rdParm[5],
|
||||
(SHORT)mr->rdParm[4], (SHORT)mr->rdParm[3], bits, info,
|
||||
@ -900,7 +900,7 @@ BOOL WINAPI PlayMetaFileRecord( HDC hdc, HANDLETABLE *ht, METARECORD *mr, UINT
|
||||
case META_DIBSTRETCHBLT:
|
||||
{
|
||||
LPBITMAPINFO info = (LPBITMAPINFO) &(mr->rdParm[10]);
|
||||
LPSTR bits = (LPSTR)info + DIB_BitmapInfoSize( info, mr->rdParm[2] );
|
||||
LPSTR bits = (LPSTR)info + bitmap_info_size( info, mr->rdParm[2] );
|
||||
StretchDIBits( hdc, (SHORT)mr->rdParm[9], (SHORT)mr->rdParm[8], (SHORT)mr->rdParm[7],
|
||||
(SHORT)mr->rdParm[6], (SHORT)mr->rdParm[5], (SHORT)mr->rdParm[4],
|
||||
(SHORT)mr->rdParm[3], (SHORT)mr->rdParm[2], bits, info,
|
||||
@ -997,7 +997,7 @@ BOOL WINAPI PlayMetaFileRecord( HDC hdc, HANDLETABLE *ht, METARECORD *mr, UINT
|
||||
|
||||
if (mr->rdSize > 12) {
|
||||
LPBITMAPINFO info = (LPBITMAPINFO) &(mr->rdParm[8]);
|
||||
LPSTR bits = (LPSTR)info + DIB_BitmapInfoSize(info, mr->rdParm[0]);
|
||||
LPSTR bits = (LPSTR)info + bitmap_info_size(info, mr->rdParm[0]);
|
||||
|
||||
StretchDIBits(hdc, (SHORT)mr->rdParm[7], (SHORT)mr->rdParm[6], (SHORT)mr->rdParm[5],
|
||||
(SHORT)mr->rdParm[4], (SHORT)mr->rdParm[3], (SHORT)mr->rdParm[2],
|
||||
@ -1027,7 +1027,7 @@ BOOL WINAPI PlayMetaFileRecord( HDC hdc, HANDLETABLE *ht, METARECORD *mr, UINT
|
||||
case META_SETDIBTODEV:
|
||||
{
|
||||
BITMAPINFO *info = (BITMAPINFO *) &(mr->rdParm[9]);
|
||||
char *bits = (char *)info + DIB_BitmapInfoSize( info, mr->rdParm[0] );
|
||||
char *bits = (char *)info + bitmap_info_size( info, mr->rdParm[0] );
|
||||
SetDIBitsToDevice(hdc, (SHORT)mr->rdParm[8], (SHORT)mr->rdParm[7],
|
||||
(SHORT)mr->rdParm[6], (SHORT)mr->rdParm[5],
|
||||
(SHORT)mr->rdParm[4], (SHORT)mr->rdParm[3],
|
||||
|
@ -101,7 +101,7 @@ BOOL MFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst,
|
||||
len,rop,lpBMI->biYPelsPerMeter,GetDeviceCaps(physDevSrc->hdc, LOGPIXELSY));
|
||||
|
||||
if (GetDIBits(physDevSrc->hdc, hBitmap, 0, (UINT)lpBMI->biHeight,
|
||||
(LPSTR)lpBMI + DIB_BitmapInfoSize( (BITMAPINFO *)lpBMI,
|
||||
(LPSTR)lpBMI + bitmap_info_size( (BITMAPINFO *)lpBMI,
|
||||
DIB_RGB_COLORS ),
|
||||
(LPBITMAPINFO)lpBMI, DIB_RGB_COLORS))
|
||||
#else
|
||||
@ -149,7 +149,7 @@ INT MFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
|
||||
DWORD len, infosize, imagesize;
|
||||
METARECORD *mr;
|
||||
|
||||
infosize = DIB_BitmapInfoSize(info, wUsage);
|
||||
infosize = bitmap_info_size(info, wUsage);
|
||||
imagesize = DIB_GetDIBImageBytes( info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount );
|
||||
@ -191,7 +191,7 @@ INT MFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDst, INT yDst, DWORD cx,
|
||||
DWORD len, infosize, imagesize;
|
||||
METARECORD *mr;
|
||||
|
||||
infosize = DIB_BitmapInfoSize(info, coloruse);
|
||||
infosize = bitmap_info_size(info, coloruse);
|
||||
imagesize = DIB_GetDIBImageBytes( info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount );
|
||||
|
@ -307,7 +307,7 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush )
|
||||
bmSize = DIB_GetDIBImageBytes(info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount);
|
||||
biSize = DIB_BitmapInfoSize(info, LOWORD(logbrush.lbColor));
|
||||
biSize = bitmap_info_size(info, LOWORD(logbrush.lbColor));
|
||||
size = sizeof(METARECORD) + biSize + bmSize + 2;
|
||||
mr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
||||
if(!mr) goto done;
|
||||
|
Loading…
Reference in New Issue
Block a user