From 86c366dcaed84bc350b2a77bf8a8b9621ded82b8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 2 Jun 2022 23:37:12 +0200 Subject: [PATCH] Remove unnecessary code from wxArtProvider::CreateBitmap() Derived art providers don't need to scale the returned bitmaps as this is already done by the base class GetBitmap() anyhow if necessary. There should be no changes in behaviour, except that we may be using our own bitmap scaling instead of GTK in some cases now. --- src/gtk/artgtk.cpp | 17 +---------------- src/msw/artmsw.cpp | 19 ------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/src/gtk/artgtk.cpp b/src/gtk/artgtk.cpp index 7523452e01..985b83d77c 100644 --- a/src/gtk/artgtk.cpp +++ b/src/gtk/artgtk.cpp @@ -306,22 +306,7 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id, if (stocksize == GTK_ICON_SIZE_INVALID) stocksize = GTK_ICON_SIZE_BUTTON; - GdkPixbuf *pixbuf = CreateGtkIcon(stockid.utf8_str(), stocksize, size); - - if (pixbuf && size != wxDefaultSize && - (size.x != gdk_pixbuf_get_width(pixbuf) || - size.y != gdk_pixbuf_get_height(pixbuf))) - { - GdkPixbuf *p2 = gdk_pixbuf_scale_simple(pixbuf, size.x, size.y, - GDK_INTERP_BILINEAR); - if (p2) - { - g_object_unref (pixbuf); - pixbuf = p2; - } - } - - return wxBitmap(pixbuf); + return wxBitmap(CreateGtkIcon(stockid.utf8_str(), stocksize, size)); } wxIconBundle diff --git a/src/msw/artmsw.cpp b/src/msw/artmsw.cpp index 3acbca568f..dc597c9839 100644 --- a/src/msw/artmsw.cpp +++ b/src/msw/artmsw.cpp @@ -210,18 +210,6 @@ static wxBitmap CreateFromStdIcon(const char *iconName, wxBitmap bmp; bmp.CopyFromIcon(icon); - // The standard native message box icons are in message box size (32x32). - // If they are requested in any size other than the default or message - // box size, they must be rescaled first. - if ( client != wxART_MESSAGE_BOX && client != wxART_OTHER ) - { - const wxSize size = wxArtProvider::GetNativeSizeHint(client); - if ( size != wxDefaultSize ) - { - wxBitmap::Rescale(bmp, size); - } - } - return bmp; } @@ -251,14 +239,7 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id, bitmap = MSWGetBitmapFromIconLocation(sii.szPath, sii.iIcon, sizeNeeded); if ( bitmap.IsOk() ) - { - if ( bitmap.GetSize() != sizeNeeded ) - { - wxBitmap::Rescale(bitmap, sizeNeeded); - } - return bitmap; - } } } #endif // wxHAS_SHGetStockIconInfo