From b889f6897ba8429c02e598ee9d5a366347fef477 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 17 Apr 2021 00:00:54 +0200 Subject: [PATCH] Fix determining height of monochrome HICON in wxGetHiconSize() For monochrome icons height reported by GetObject() is doubled because icon bitmap contains both AND and XOR masks. To get actual icon height we need to divide the value by 2. Closes #19146. --- src/msw/gdiimage.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index 8bb2cf6ecf..6b43e76c5d 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -660,6 +660,12 @@ wxSize wxGetHiconSize(HICON hicon) size = wxSize(bm.bmWidth, bm.bmHeight); } } + // For monochrome icon reported height is doubled + // because it contains both AND and XOR masks. + if ( info.hbmColor == NULL ) + { + size.y /= 2; + } } }