From bd0db4a5f9401fcdf5ab9c0b4c28b98f1308eab2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 5 Feb 2022 16:20:09 +0000 Subject: [PATCH] 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(). --- src/common/artprov.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/common/artprov.cpp b/src/common/artprov.cpp index 4663ebde23..23f637d98b 100644 --- a/src/common/artprov.cpp +++ b/src/common/artprov.cpp @@ -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); }