GNOME Bugzilla – Bug 744991
Fix loading of GResource SVGs
Last modified: 2015-02-23 17:59:14 UTC
When a GFileIcon is loaded with a GResourceFile SVG, GtkIconTheme will fail to apply the requested scale factor, causing blurry icons. This can be reproduced in gnome-shell's new notification/calendar panel on a hi-dpi display.
Created attachment 297614 [details] [review] icontheme: fill correct information when loading GResource-backed GIcons When loading a GResource-backed GFileIcon into a GtkIconInfo we currently fail to populate the is_resource private field. Also, since is_svg is set by looking at the filename, and g_file_get_path() returns NULL for a GResourceFile, is_svg was always FALSE.
Created attachment 297615 [details] [review] icontheme: use desired size instead of negative for DIR_UNTHEMED SVGs When loading SVGs from ICON_THEME_DIR_UNTHEMED GtkIconInfos, such as those created for a GLoadableIcon, the size of the pixbuf to load is set as a product of icon_info->scale. But a few lines above, icon_info->scale is set to -1 for ICON_THEME_DIR_UNTHEMED GtkIconInfos, so we'll end up always passing a negative size to the GdkPixbuf loader, which is interpreted as the nominal size of the image file. Instead load the SVG at the desired scaled size in that case. This fixes blurry icon in the notification panel in gnome-shell.
Review of attachment 297614 [details] [review]: Are you sure this is not breaking other places that assume info->filename is, you know, an actual path in the file system ?
Review of attachment 297614 [details] [review]: didn't meant to reject this
Review of attachment 297615 [details] [review]: makes sense
(In reply to Matthias Clasen from comment #3) > Review of attachment 297614 [details] [review] [review]: > > Are you sure this is not breaking other places that assume info->filename > is, you know, an actual path in the file system ? Yeah, because that's also what happens in the other info->is_resource cases. See https://git.gnome.org/browse/gtk+/tree/gtk/gtkicontheme.c#n1780 https://git.gnome.org/browse/gtk+/tree/gtk/gtkicontheme.c#n3058
Review of attachment 297614 [details] [review]: ok then
Thanks, pushed. Attachment 297614 [details] pushed as acd72ff - icontheme: fill correct information when loading GResource-backed GIcons Attachment 297615 [details] pushed as eddaf01 - icontheme: use desired size instead of negative for DIR_UNTHEMED SVGs