Mark Jansen : user32: Correctly determine bit count for BITMAPCOREINFO in is_dib_monochrome.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 28 09:12:37 CDT 2016


Module: wine
Branch: master
Commit: e1f1a60f875873882a9d1ce28ba5726c3059d3e1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e1f1a60f875873882a9d1ce28ba5726c3059d3e1

Author: Mark Jansen <learn0more at gmail.com>
Date:   Sun Mar 27 15:44:32 2016 +0200

user32: Correctly determine bit count for BITMAPCOREINFO in is_dib_monochrome.

Signed-off-by: Mark Jansen <learn0more at gmail.com>
Signed-off-by: Thomas Faber <thomas.faber at reactos.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/cursoricon.c       | 6 ++++--
 dlls/user32/tests/cursoricon.c | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 4f62635..4de6b28 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -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))
diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c
index 232a02e..6648ede 100644
--- a/dlls/user32/tests/cursoricon.c
+++ b/dlls/user32/tests/cursoricon.c
@@ -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




More information about the wine-cvs mailing list