[gtk/wip/matthiasc/opbuffer] icon theme: Avoid mime sniffing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/opbuffer] icon theme: Avoid mime sniffing
- Date: Tue, 15 Oct 2019 23:06:42 +0000 (UTC)
commit 8590594b2849ea6592b7664b8d3be4dbaa48d062
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 15 19:05:52 2019 -0400
icon theme: Avoid mime sniffing
Themed icons are always pngs or svgs.
Take advantage of that to avoid costly
mime sniffing.
gtk/gtkicontheme.c | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 8a580fb4ac..ee7f7c49bb 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3384,16 +3384,19 @@ icon_info_ensure_scale_and_texture (GtkIconInfo *icon_info)
&icon_info->load_error);
else if (size == 0)
source_pixbuf = _gdk_pixbuf_new_from_resource_scaled (icon_info->filename,
+ "svg",
icon_info->desired_scale,
&icon_info->load_error);
else
- source_pixbuf = gdk_pixbuf_new_from_resource_at_scale (icon_info->filename,
- size, size, TRUE,
- &icon_info->load_error);
+ source_pixbuf = _gdk_pixbuf_new_from_resource_at_scale (icon_info->filename,
+ "svg",
+ size, size, TRUE,
+ &icon_info->load_error);
}
else
- source_pixbuf = gdk_pixbuf_new_from_resource (icon_info->filename,
- &icon_info->load_error);
+ source_pixbuf = _gdk_pixbuf_new_from_resource (icon_info->filename,
+ "png",
+ &icon_info->load_error);
}
else
{
@@ -3425,19 +3428,22 @@ icon_info_ensure_scale_and_texture (GtkIconInfo *icon_info)
&icon_info->load_error);
else if (size == 0)
source_pixbuf = _gdk_pixbuf_new_from_stream_scaled (stream,
+ "svg",
icon_info->desired_scale,
NULL,
&icon_info->load_error);
else
- source_pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream,
- size, size,
- TRUE, NULL,
+ source_pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream,
+ "svg",
+ size, size,
+ TRUE, NULL,
&icon_info->load_error);
}
else
- source_pixbuf = gdk_pixbuf_new_from_stream (stream,
- NULL,
- &icon_info->load_error);
+ source_pixbuf = _gdk_pixbuf_new_from_stream (stream,
+ "png",
+ NULL,
+ &icon_info->load_error);
g_object_unref (stream);
}
}
@@ -3938,7 +3944,8 @@ gtk_icon_info_load_symbolic_svg (GtkIconInfo *icon_info,
g_free (height);
stream = g_memory_input_stream_new_from_data (data, -1, g_free);
- pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream,
+ pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream,
+ "svg",
gdk_texture_get_width (icon_info->texture),
gdk_texture_get_height (icon_info->texture),
TRUE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]