[gtk+/spinner] GtkIconTheme: Fix symbolic loading



commit d3292da1997dfec5e9736785e5095156945622d4
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 20 17:01:21 2014 -0400

    GtkIconTheme: Fix symbolic loading
    
    We need to give the recoloring wrapper the same size as the
    original svg, or things go wrong. For expediency, just assume
    that the svg has the nominal size of the directory it is in,
    which will be true for all current symbolic icons.

 gtk/gtkicontheme.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index fbedb1e..52ac182 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -4154,7 +4154,7 @@ gtk_icon_info_load_symbolic_internal (GtkIconInfo    *icon_info,
   gchar *css_warning;
   gchar *css_error;
   gchar *data;
-  gchar *width, *height;
+  gchar *size;
   gchar *file_data, *escaped_file_data;
   gsize file_len;
   SymbolicPixbufCache *symbolic_cache;
@@ -4197,8 +4197,7 @@ gtk_icon_info_load_symbolic_internal (GtkIconInfo    *icon_info,
   if (!icon_info_ensure_scale_and_pixbuf (icon_info, FALSE))
     return NULL;
 
-  width = g_strdup_printf ("%d", gdk_pixbuf_get_width (icon_info->pixbuf));
-  height = g_strdup_printf ("%d", gdk_pixbuf_get_height (icon_info->pixbuf));
+  size = g_strdup_printf ("%d", icon_info->dir_size * icon_info->dir_scale);
 
   escaped_file_data = g_markup_escape_text (file_data, file_len);
   g_free (file_data);
@@ -4207,8 +4206,8 @@ gtk_icon_info_load_symbolic_internal (GtkIconInfo    *icon_info,
                       "<svg version=\"1.1\"\n"
                       "     xmlns=\"http://www.w3.org/2000/svg\"\n";
                       "     xmlns:xi=\"http://www.w3.org/2001/XInclude\"\n";
-                      "     width=\"", width, "\"\n"
-                      "     height=\"", height, "\">\n"
+                      "     width=\"", size, "\"\n"
+                      "     height=\"", size, "\">\n"
                       "  <style type=\"text/css\">\n"
                       "    rect,path {\n"
                       "      fill: ", css_fg," !important;\n"
@@ -4231,8 +4230,7 @@ gtk_icon_info_load_symbolic_internal (GtkIconInfo    *icon_info,
   g_free (css_warning);
   g_free (css_error);
   g_free (css_success);
-  g_free (width);
-  g_free (height);
+  g_free (size);
 
   stream = g_memory_input_stream_new_from_data (data, -1, g_free);
   pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream,


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