After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744991 - Fix loading of GResource SVGs
Fix loading of GResource SVGs
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-02-23 02:19 UTC by Cosimo Cecchi
Modified: 2015-02-23 17:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
icontheme: fill correct information when loading GResource-backed GIcons (1.57 KB, patch)
2015-02-23 02:19 UTC, Cosimo Cecchi
accepted-commit_now Details | Review
icontheme: use desired size instead of negative for DIR_UNTHEMED SVGs (1.78 KB, patch)
2015-02-23 02:19 UTC, Cosimo Cecchi
accepted-commit_now Details | Review

Description Cosimo Cecchi 2015-02-23 02:19:01 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.
Comment 1 Cosimo Cecchi 2015-02-23 02:19:04 UTC
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.
Comment 2 Cosimo Cecchi 2015-02-23 02:19:08 UTC
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.
Comment 3 Matthias Clasen 2015-02-23 15:59:17 UTC
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 ?
Comment 4 Matthias Clasen 2015-02-23 16:04:09 UTC
Review of attachment 297614 [details] [review]:

didn't meant to reject this
Comment 5 Matthias Clasen 2015-02-23 16:05:02 UTC
Review of attachment 297615 [details] [review]:

makes sense
Comment 6 Cosimo Cecchi 2015-02-23 17:31:39 UTC
(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
Comment 7 Matthias Clasen 2015-02-23 17:53:17 UTC
Review of attachment 297614 [details] [review]:

ok then
Comment 8 Cosimo Cecchi 2015-02-23 17:59:14 UTC
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