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
This commit is contained in:
Artur Wieczorek
2015-08-07 23:47:07 +02:00
committed by Vadim Zeitlin
parent 244ec264af
commit 03d9c427e0

View File

@@ -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