From 03d9c427e0bf194fa7fe36979d3bd7010beb6a29 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 7 Aug 2015 23:47:07 +0200 Subject: [PATCH] Fix size of some bitmaps returned by wxWindowsArtProvider. Bitmaps obtained using SHGetStockIconInfo can have only some predefined sizes. If size of the retrieved bitmap doesn't correspond to the needed size or the size given by wxArtProvider::GetNativeSizeHint() then the bitmap should be rescaled appropriately. Closes #17071. Closes https://github.com/wxWidgets/wxWidgets/pull/64 --- src/msw/artmsw.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/msw/artmsw.cpp b/src/msw/artmsw.cpp index 9d8935f49c..cb5a31884b 100644 --- a/src/msw/artmsw.cpp +++ b/src/msw/artmsw.cpp @@ -197,7 +197,20 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id, ::DestroyIcon(sii.hIcon); if ( bitmap.IsOk() ) + { + const wxSize + sizeNeeded = size.IsFullySpecified() + ? size + : wxArtProvider::GetNativeSizeHint(client); + + if ( sizeNeeded.IsFullySpecified() && + bitmap.GetSize() != sizeNeeded ) + { + wxArtProvider::RescaleBitmap(bitmap, sizeNeeded); + } + return bitmap; + } } } #endif // wxHAS_SHGetStockIconInfo