Still resize (16, 15) bitmaps to (16, 16) ones in wxArtProvider

Don't rescale these bitmaps because, as the pre-existing comment said,
this would be too ugly, but still ensure that the returned bitmap has
the correct size to satisfy the post-condition of GetBitmap().
This commit is contained in:
Vadim Zeitlin
2022-02-05 16:20:09 +00:00
parent 52bff00b19
commit bd0db4a5f9

View File

@@ -320,13 +320,8 @@ wxArtProvider::RescaleOrResizeIfNeeded(wxBitmap& bmp, const wxSize& sizeNeeded)
if ( bmp_w == sizeNeeded.x && bmp_h == sizeNeeded.y )
return;
if (bmp_w == 16 && bmp_h == 15 && sizeNeeded == wxSize(16, 16))
{
// Do nothing in this special but quite common case, because scaling
// with only a pixel difference will look horrible.
}
#if wxUSE_IMAGE
else if ((bmp_h < sizeNeeded.x) && (bmp_w < sizeNeeded.y))
if ((bmp_h <= sizeNeeded.x) && (bmp_w <= sizeNeeded.y))
{
// the caller wants default size, which is larger than
// the image we have; to avoid degrading it visually by
@@ -336,8 +331,8 @@ wxArtProvider::RescaleOrResizeIfNeeded(wxBitmap& bmp, const wxSize& sizeNeeded)
img.Resize(sizeNeeded, offset);
bmp = wxBitmap(img);
}
#endif // wxUSE_IMAGE
else // scale (down or mixed, but not up)
#endif // wxUSE_IMAGE
{
wxBitmap::Rescale(bmp, sizeNeeded);
}