GNOME Bugzilla – Bug 708384
icontheme: Make sure icon_info->scale doesn't end up 0
Last modified: 2013-09-23 10:45:57 UTC
See patch. (Alex promised to take a look later)
Created attachment 255310 [details] [review] icontheme: Make sure icon_info->scale doesn't end up 0 GdkPixbuf will fail returning %NULL if we try to scale a pixbuf to (0, 0), which will then trigger an assertion in gtk_icon_info_load_icon_finish(); we never want a scale of 0, so ensure it is at least 1.
This is fine as a workaround. I'll have a look for a better solution later.
Review of attachment 255310 [details] [review]: ok
Comment on attachment 255310 [details] [review] icontheme: Make sure icon_info->scale doesn't end up 0 Attachment 255310 [details] pushed as f081552 - icontheme: Make sure icon_info->scale doesn't end up 0
So, here is the real problem: In the old days for e.g a FIXED directory, or a THRESHOLD directory when the requested size was inside the directory size limits, we *always* set the scale factor to 1, as these are not supposed to be scaled. So, for example, suppose you look up a icon at size 28, and the only matching icon is of size 24. This will always result in us picking the 24 icon. If this is in a SCALABLE directory we will just scale it by 28/24 == 1.1667. However, if the directory is FIXED we always use scale factor 1, which means the app gets to pad to whatever size it wants. Now, consider the case of HiDPI. We're looking up at 28@2x, and if we find an icon in a Size=24 Scale=2 directory we will just return it with scale=1. However, if there is no 24@2x icon but there is a 48@1x icon we generally want to act as if this was a 24@2x icon to avoid fuzzy icons. So, this would similarly just return a scale 1.0. *However* Consider the case where we only had a 24@1x icon, like in the scale 1 case above. In order to look the same as the scale 1 case (but maybe a bit fuzzy) we *should* scale this by 2.0. So, in the complex cases we have: desired_size = 28 desired_scale = 2 scaled_desired_scale = 56 In one case we have: dir_size=24 dir_scale=1 Here we want to return scale = 2 In the other case we have dir_size=48 dir_scale=1 Here we want to return scale = 1 I don't know how to pick this in a good way here, as its kinda hard to disentangle the two cases. Maybe we need to do that at some earlier point...
Created attachment 255555 [details] [review] icon-theme: Better handling of unscaled icon directories If an icon is in a Fixed or Threshold directory we normally don't scale it. However, in the case of HiDPI scaling we *do* want to scale it, to avoid different layouts in Lo/HiDPI. We look up whatever the size of the icon would have been in LoDPI and scale to that in the no-scaling case, thus getting the same layout as the unscaled case.
Attachment 255555 [details] pushed as 68c4504 - icon-theme: Better handling of unscaled icon directories