icontheme: Don't try to scale pixbufs to same size
authorTimm Bäder <mail@baedert.org>
Fri, 30 Aug 2019 12:23:56 +0000 (14:23 +0200)
committerTimm Bäder <mail@baedert.org>
Mon, 9 Sep 2019 15:36:26 +0000 (17:36 +0200)
gtk/gtkicontheme.c

index edf61e4a6b098e095ba3648c8e549a8df7bb6613..6cf0c82ab9695578d634787292a481fd6bf0d4e0 100644 (file)
@@ -4890,21 +4890,27 @@ gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme       *icon_theme,
         {
           gint width, height, max;
           gdouble pixbuf_scale;
-          GdkPixbuf *scaled;
 
           width = gdk_pixbuf_get_width (pixbuf);
           height = gdk_pixbuf_get_height (pixbuf);
           max = MAX (width, height);
           pixbuf_scale = (gdouble) size * scale / (gdouble) max;
 
-          scaled = gdk_pixbuf_scale_simple (pixbuf,
-                                            0.5 + width * pixbuf_scale,
-                                            0.5 + height * pixbuf_scale,
-                                            GDK_INTERP_BILINEAR);
-
-          info = gtk_icon_info_new_for_pixbuf (icon_theme, scaled);
-
-          g_object_unref (scaled);
+           if (pixbuf_scale != 1.0)
+             {
+              GdkPixbuf *scaled;
+              scaled = gdk_pixbuf_scale_simple (pixbuf,
+                                                0.5 + width * pixbuf_scale,
+                                                0.5 + height * pixbuf_scale,
+                                                GDK_INTERP_BILINEAR);
+
+              info = gtk_icon_info_new_for_pixbuf (icon_theme, scaled);
+              g_object_unref (scaled);
+             }
+           else
+             {
+              info = gtk_icon_info_new_for_pixbuf (icon_theme, pixbuf);
+             }
         }
       else
         {