[gtk/wip/baedert/icontheme2: 1/4] icontheme: Don't try to scale pixbufs to same size



commit bc13cb1ad80c8e3494b7e97ae4aa7f66f1fc03e5
Author: Timm Bäder <mail baedert org>
Date:   Fri Aug 30 14:23:56 2019 +0200

    icontheme: Don't try to scale pixbufs to same size

 gtk/gtkicontheme.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 8212c122af..37b4787e40 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -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
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]