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.
This commit is contained in:
Vadim Zeitlin
2022-06-02 23:37:12 +02:00
parent 0bd2a6c105
commit 86c366dcae
2 changed files with 1 additions and 35 deletions

View File

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

View File

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