mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:26:17 +00:00
[WIN32K]
Handle DIB_PAL_INDICES in DIB_BitmapInfoSize svn path=/trunk/; revision=66892
This commit is contained in:
parent
0f8766d749
commit
ec0f3d9ba9
1 changed files with 7 additions and 3 deletions
|
@ -1916,13 +1916,17 @@ INT APIENTRY DIB_GetDIBImageBytes(INT width, INT height, INT depth)
|
||||||
INT FASTCALL DIB_BitmapInfoSize(const BITMAPINFO * info, WORD coloruse)
|
INT FASTCALL DIB_BitmapInfoSize(const BITMAPINFO * info, WORD coloruse)
|
||||||
{
|
{
|
||||||
unsigned int colors, size, masks = 0;
|
unsigned int colors, size, masks = 0;
|
||||||
|
unsigned int colorsize;
|
||||||
|
|
||||||
|
colorsize = (coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) :
|
||||||
|
(coloruse == DIB_PAL_INDICES) ? 0 :
|
||||||
|
sizeof(WORD);
|
||||||
|
|
||||||
if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||||
{
|
{
|
||||||
const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)info;
|
const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)info;
|
||||||
colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0;
|
colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0;
|
||||||
return sizeof(BITMAPCOREHEADER) + colors *
|
return sizeof(BITMAPCOREHEADER) + colors * colorsize;
|
||||||
((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD));
|
|
||||||
}
|
}
|
||||||
else /* Assume BITMAPINFOHEADER */
|
else /* Assume BITMAPINFOHEADER */
|
||||||
{
|
{
|
||||||
|
@ -1932,7 +1936,7 @@ INT FASTCALL DIB_BitmapInfoSize(const BITMAPINFO * info, WORD coloruse)
|
||||||
colors = 1 << info->bmiHeader.biBitCount;
|
colors = 1 << info->bmiHeader.biBitCount;
|
||||||
if (info->bmiHeader.biCompression == BI_BITFIELDS) masks = 3;
|
if (info->bmiHeader.biCompression == BI_BITFIELDS) masks = 3;
|
||||||
size = max( info->bmiHeader.biSize, sizeof(BITMAPINFOHEADER) + masks * sizeof(DWORD) );
|
size = max( info->bmiHeader.biSize, sizeof(BITMAPINFOHEADER) + masks * sizeof(DWORD) );
|
||||||
return size + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD));
|
return size + colors * colorsize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue