From: Benjamin Otte Date: Fri, 17 Sep 2021 02:07:59 +0000 (+0200) Subject: icontheme: Implement gtk_icon_theme_lookup_by_gicon() for textures X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~5^2~340^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=37a7c6780ace8ae719cd10bc46898bd23a2b0f04;p=gtk4.git icontheme: Implement gtk_icon_theme_lookup_by_gicon() for textures More feature parity. Before this, it would have worked just as well - just going via a PNG bytes step inbetween. --- diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index eaeb8e4063..1c2d83125c 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -4084,20 +4084,6 @@ gtk_icon_paintable_new_for_file (GFile *file, return icon; } -static GtkIconPaintable * -gtk_icon_paintable_new_for_pixbuf (GtkIconTheme *icon_theme, - GdkPixbuf *pixbuf, - int size, - int scale) -{ - GtkIconPaintable *icon; - - icon = icon_paintable_new (NULL, size, scale); - icon->texture = gdk_texture_new_for_pixbuf (pixbuf); - - return icon; -} - /** * gtk_icon_theme_lookup_by_gicon: * @self: a `GtkIconTheme` @@ -4135,11 +4121,15 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self, gicon = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (gicon)); g_assert (gicon); /* shut up gcc -Wnull-dereference */ - if (GDK_IS_PIXBUF (gicon)) + if (GDK_IS_TEXTURE (gicon)) { - GdkPixbuf *pixbuf = GDK_PIXBUF (gicon); - - icon = gtk_icon_paintable_new_for_pixbuf (self, pixbuf, size, scale); + icon = icon_paintable_new (NULL, size, scale); + icon->texture = g_object_ref (GDK_TEXTURE (icon)); + } + else if (GDK_IS_PIXBUF (gicon)) + { + icon = icon_paintable_new (NULL, size, scale); + icon->texture = gdk_texture_new_for_pixbuf (GDK_PIXBUF (icon)); } else if (G_IS_FILE_ICON (gicon)) {