Take into account scale factor of images added to wxImageList

Closes #19114.
This commit is contained in:
Daniel Kulp 2021-04-03 18:03:33 +02:00 committed by Artur Wieczorek
parent 767de514c1
commit eb52e86553

View file

@ -69,7 +69,7 @@ wxBitmap GetImageListBitmap(const wxBitmap& bitmap, bool useMask, const wxSize&
#if wxUSE_IMAGE #if wxUSE_IMAGE
wxImage img = bmp.ConvertToImage(); wxImage img = bmp.ConvertToImage();
img.ClearAlpha(); img.ClearAlpha();
bmp = img; bmp = wxBitmap(img, -1, bmp.GetScaleFactor());
#endif // wxUSE_IMAGE #endif // wxUSE_IMAGE
} }
} }
@ -81,7 +81,7 @@ wxBitmap GetImageListBitmap(const wxBitmap& bitmap, bool useMask, const wxSize&
#if wxUSE_IMAGE #if wxUSE_IMAGE
wxImage img = bmp.ConvertToImage(); wxImage img = bmp.ConvertToImage();
img.ConvertAlphaToMask(); img.ConvertAlphaToMask();
bmp = img; bmp = wxBitmap(img, -1, bmp.GetScaleFactor());
#endif // wxUSE_IMAGE #endif // wxUSE_IMAGE
} }
else else
@ -107,7 +107,7 @@ wxBitmap GetImageListBitmap(const wxBitmap& bitmap, bool useMask, const wxSize&
#if wxUSE_IMAGE #if wxUSE_IMAGE
wxImage img = bmp.ConvertToImage(); wxImage img = bmp.ConvertToImage();
img.InitAlpha(); img.InitAlpha();
bmp = img; bmp = wxBitmap(img, -1, bmp.GetScaleFactor());
#else #else
bmp.SetMask(NULL); bmp.SetMask(NULL);
#endif // wxUSE_IMAGE #endif // wxUSE_IMAGE
@ -117,7 +117,7 @@ wxBitmap GetImageListBitmap(const wxBitmap& bitmap, bool useMask, const wxSize&
// Ensure image size is the same as the size of the images on the image list. // Ensure image size is the same as the size of the images on the image list.
wxBitmap bmpResized; wxBitmap bmpResized;
const wxSize sz = bmp.GetSize(); const wxSize sz = bmp.GetScaledSize();
if ( sz.x == imgSize.x && sz.y == imgSize.y ) if ( sz.x == imgSize.x && sz.y == imgSize.y )
{ {
bmpResized = bmp; bmpResized = bmp;