diff --git a/win32ss/user/user32/windows/cursoricon.c b/win32ss/user/user32/windows/cursoricon.c index 6299c83900..3382a78b9b 100644 --- a/win32ss/user/user32/windows/cursoricon.c +++ b/win32ss/user/user32/windows/cursoricon.c @@ -115,22 +115,22 @@ static int get_dib_image_size( int width, int height, int depth ) static BOOL is_dib_monochrome( const BITMAPINFO* info ) { + BOOL found_black = FALSE, found_white = 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)) - { - rgb++; + if ((rgb[0].rgbtRed == 0) && (rgb[0].rgbtGreen == 0) && (rgb[0].rgbtBlue == 0)) + found_black = TRUE; + if ((rgb[0].rgbtRed == 0xff) && (rgb[0].rgbtGreen == 0xff) && (rgb[0].rgbtBlue == 0xff)) + found_white = TRUE; - /* Check if the second color is white */ - return ((rgb->rgbtRed == 0xff) && (rgb->rgbtGreen == 0xff) - && (rgb->rgbtBlue == 0xff)); - } - else return FALSE; + if ((rgb[1].rgbtRed == 0) && (rgb[1].rgbtGreen == 0) && (rgb[1].rgbtBlue == 0)) + found_black = TRUE; + if ((rgb[1].rgbtRed == 0xff) && (rgb[1].rgbtGreen == 0xff) && (rgb[1].rgbtBlue == 0xff)) + found_white = TRUE; } else /* assume BITMAPINFOHEADER */ { @@ -138,18 +138,17 @@ static BOOL is_dib_monochrome( const BITMAPINFO* info ) 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)) - { - rgb++; + if ((rgb[0].rgbRed == 0) && (rgb[0].rgbGreen == 0) && (rgb[0].rgbBlue == 0) && (rgb[0].rgbReserved == 0)) + found_black = TRUE; + if ((rgb[0].rgbRed == 0xff) && (rgb[0].rgbGreen == 0xff) && (rgb[0].rgbBlue == 0xff) && (rgb[0].rgbReserved == 0)) + found_white = TRUE; - /* Check if the second color is white */ - return ((rgb->rgbRed == 0xff) && (rgb->rgbGreen == 0xff) - && (rgb->rgbBlue == 0xff) && (rgb->rgbReserved == 0)); - } - else return FALSE; + if ((rgb[1].rgbRed == 0) && (rgb[1].rgbGreen == 0) && (rgb[1].rgbBlue == 0) && (rgb[1].rgbReserved == 0)) + found_black = TRUE; + if ((rgb[1].rgbRed == 0xff) && (rgb[1].rgbGreen == 0xff) && (rgb[1].rgbBlue == 0xff) && (rgb[1].rgbReserved == 0)) + found_white = TRUE; } + return found_black && found_white; } static int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )