user32: Correctly determine bit count for BITMAPCOREINFO in is_dib_monochrome.

Signed-off-by: Mark Jansen <learn0more@gmail.com>
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Mark Jansen 2016-03-27 15:44:32 +02:00 committed by Alexandre Julliard
parent 6ad5cfbebd
commit e1f1a60f87
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -2584,7 +2584,6 @@ static void test_monochrome_icon(void)
ok(icon_info.fIcon == TRUE, "fIcon is %u.\n", icon_info.fIcon);
ok(icon_info.xHotspot == 0, "xHotspot is %u.\n", icon_info.xHotspot);
ok(icon_info.yHotspot == 0, "yHotspot is %u.\n", icon_info.yHotspot);
todo_wine_if(monochrome && use_core_info)
if (monochrome)
ok(icon_info.hbmColor == NULL, "Got hbmColor %p!\n", icon_info.hbmColor);
else