summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2019-09-02 08:29:04 +0200
committerTimm Bäder <mail@baedert.org>2019-09-02 09:18:05 +0200
commitcbf741920b06279fbea82f5b839164a9511e0198 (patch)
tree1821238b2d02132428ae46b8ba3f1782e0925357
parent3beb6bfb4bcad2c98291f0df232b3863a88c7d24 (diff)
downloadgtk+-wip/baedert/icontheme2.tar.gz
pixbufutils: Escape file data only oncewip/baedert/icontheme2
-rw-r--r--gtk/tools/gdkpixbufutils.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gtk/tools/gdkpixbufutils.c b/gtk/tools/gdkpixbufutils.c
index 5127cb9e87..5f8c19bf87 100644
--- a/gtk/tools/gdkpixbufutils.c
+++ b/gtk/tools/gdkpixbufutils.c
@@ -132,8 +132,7 @@ _gdk_pixbuf_new_from_resource_scaled (const gchar *resource_path,
}
static GdkPixbuf *
-load_symbolic_svg (const char *file_data,
- gsize file_len,
+load_symbolic_svg (const char *escaped_file_data,
int width,
int height,
double scale,
@@ -149,7 +148,6 @@ load_symbolic_svg (const char *file_data,
GdkPixbuf *pixbuf;
gchar *data;
gchar *svg_width, *svg_height;
- gchar *escaped_file_data;
if (width == 0)
width = icon_width * scale;
@@ -159,8 +157,6 @@ load_symbolic_svg (const char *file_data,
svg_width = g_strdup_printf ("%d", icon_width);
svg_height = g_strdup_printf ("%d", icon_height);
- escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
-
data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
"<svg version=\"1.1\"\n"
" xmlns=\"http://www.w3.org/2000/svg\"\n"
@@ -184,7 +180,6 @@ load_symbolic_svg (const char *file_data,
" <xi:include href=\"data:text/xml;base64,", escaped_file_data, "\"/>\n"
"</svg>",
NULL);
- g_free (escaped_file_data);
g_free (svg_width);
g_free (svg_height);
@@ -246,6 +241,7 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
GdkPixbuf *pixbuf = NULL;
int plane;
int icon_width, icon_height;
+ char *escaped_file_data;
/* Fetch size from the original icon */
{
@@ -262,6 +258,8 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
g_object_unref (reference);
}
+ escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
+
for (plane = 0; plane < 3; plane++)
{
/* Here we render the svg with all colors solid, this should
@@ -276,7 +274,7 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
* channels, with the color of the fg being implicitly
* the "rest", as all color fractions should add up to 1.
*/
- loaded = load_symbolic_svg (file_data, file_len, width, height, scale,
+ loaded = load_symbolic_svg (escaped_file_data, width, height, scale,
icon_width,
icon_height,
g_string,
@@ -303,6 +301,8 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
g_object_unref (loaded);
}
+ g_free (escaped_file_data);
+
return pixbuf;
}