1From 4d09ff324419fe4e671233044e424378da53969b Mon Sep 17 00:00:00 2001 2From: Jussi Kukkonen <jussi.kukkonen@intel.com> 3Date: Tue, 9 Jun 2015 14:20:30 +0300 4Subject: [PATCH] Remove Gdk-dependency from gtk-encode-symbolic-svg 5 6Building gtk-encode-symbolic-svg without building Gdk is useful 7as only the icon tools are needed on the native build: this makes 8native build much faster and requires much less dependencies. 9 10Upstream-Status: Pending 11 12Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> 13Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> 14--- 15Patch status: taken from yocto, upstream pending 16 17 gtk/encodesymbolic.c | 36 ++++++++++-------------------------- 18 1 file changed, 10 insertions(+), 26 deletions(-) 19 20diff --git a/gtk/encodesymbolic.c b/gtk/encodesymbolic.c 21index 9f7d015..1f07563 100644 22--- a/gtk/encodesymbolic.c 23+++ b/gtk/encodesymbolic.c 24@@ -19,7 +19,6 @@ 25 26 #include <glib.h> 27 #include <gdk-pixbuf/gdk-pixdata.h> 28-#include <gdk/gdk.h> 29 #include <glib/gi18n.h> 30 31 #ifdef HAVE_UNISTD_H 32@@ -43,30 +42,18 @@ static GdkPixbuf * 33 load_symbolic_svg (char *file_data, gsize file_len, 34 int width, 35 int height, 36- const GdkRGBA *fg, 37- const GdkRGBA *success_color, 38- const GdkRGBA *warning_color, 39- const GdkRGBA *error_color, 40+ const char *css_fg, 41+ const char *css_success, 42+ const char *css_warning, 43+ const char *css_error, 44 GError **error) 45 { 46 GInputStream *stream; 47 GdkPixbuf *pixbuf; 48- gchar *css_fg; 49- gchar *css_success; 50- gchar *css_warning; 51- gchar *css_error; 52 gchar *data; 53 gchar *svg_width, *svg_height; 54 gchar *escaped_file_data; 55 56- css_fg = gdk_rgba_to_string (fg); 57- 58- css_success = css_warning = css_error = NULL; 59- 60- css_warning = gdk_rgba_to_string (warning_color); 61- css_error = gdk_rgba_to_string (error_color); 62- css_success = gdk_rgba_to_string (success_color); 63- 64 /* Fetch size from the original icon */ 65 stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL); 66 pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, error); 67@@ -105,10 +92,6 @@ load_symbolic_svg (char *file_data, gsize file_len, 68 "</svg>", 69 NULL); 70 g_free (escaped_file_data); 71- g_free (css_fg); 72- g_free (css_warning); 73- g_free (css_error); 74- g_free (css_success); 75 g_free (svg_width); 76 g_free (svg_height); 77 78@@ -167,7 +150,8 @@ make_symbolic_pixbuf (char *file, 79 GError **error) 80 81 { 82- GdkRGBA r = { 1,0,0,1}, g = {0,1,0,1}; 83+ const char r[] = "rgba(255,0,0,1)"; 84+ const char g[] = "rgba(0,255,0,1)"; 85 GdkPixbuf *loaded; 86 GdkPixbuf *pixbuf; 87 int plane; 88@@ -196,10 +180,10 @@ make_symbolic_pixbuf (char *file, 89 * the "rest", as all color fractions should add up to 1. 90 */ 91 loaded = load_symbolic_svg (file_data, file_len, width, height, 92- &g, 93- plane == 0 ? &r : &g, 94- plane == 1 ? &r : &g, 95- plane == 2 ? &r : &g, 96+ g, 97+ plane == 0 ? r : g, 98+ plane == 1 ? r : g, 99+ plane == 2 ? r : g, 100 error); 101 if (loaded == NULL) 102 return NULL; 103-- 1042.1.4 105 106