- Fix is_dib_monochrome for bitmaps using BITMAPCOREINFO. Patch by Mark Jansen.
CORE-10889

svn path=/trunk/; revision=71063
This commit is contained in:
Thomas Faber 2016-03-28 14:58:20 +00:00
parent 6da01fa019
commit 677a03e5af

View file

@ -117,12 +117,12 @@ static int get_dib_image_size( int width, int height, int depth )
static BOOL is_dib_monochrome( const BITMAPINFO* info ) static BOOL is_dib_monochrome( const BITMAPINFO* info )
{ {
if (info->bmiHeader.biBitCount != 1) return FALSE;
if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{ {
const RGBTRIPLE *rgb = ((const BITMAPCOREINFO*)info)->bmciColors; const RGBTRIPLE *rgb = ((const BITMAPCOREINFO*)info)->bmciColors;
if (((const BITMAPCOREINFO*)info)->bmciHeader.bcBitCount != 1) return FALSE;
/* Check if the first color is black */ /* Check if the first color is black */
if ((rgb->rgbtRed == 0) && (rgb->rgbtGreen == 0) && (rgb->rgbtBlue == 0)) if ((rgb->rgbtRed == 0) && (rgb->rgbtGreen == 0) && (rgb->rgbtBlue == 0))
{ {
@ -138,6 +138,8 @@ static BOOL is_dib_monochrome( const BITMAPINFO* info )
{ {
const RGBQUAD *rgb = info->bmiColors; const RGBQUAD *rgb = info->bmiColors;
if (info->bmiHeader.biBitCount != 1) return FALSE;
/* Check if the first color is black */ /* Check if the first color is black */
if ((rgb->rgbRed == 0) && (rgb->rgbGreen == 0) && if ((rgb->rgbRed == 0) && (rgb->rgbGreen == 0) &&
(rgb->rgbBlue == 0) && (rgb->rgbReserved == 0)) (rgb->rgbBlue == 0) && (rgb->rgbReserved == 0))