Merge lp:~evfool/pantheon-files/lp1082225 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Robert Roth
Status: Merged
Approved by: Danielle Foré
Approved revision: 1443
Merged at revision: 1443
Proposed branch: lp:~evfool/pantheon-files/lp1082225
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 28 lines (+5/-2)
2 files modified
libcore/marlin-icon-info.c (+4/-1)
src/marlin-icon-renderer.c (+1/-1)
To merge this branch: bzr merge lp:~evfool/pantheon-files/lp1082225
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+210716@code.launchpad.net

Commit message

If the pixbuf size is less than the image size we want, do not scale it up, as it results in a blurry image.

Description of the change

This branch fixes bug #1082225.
* If the pixbuf size is less than the image size we want, do not scale it up, as it results in a blurry image.
I did not take the solution from thunar (although the result is the same) as suggested in the bug, as thunar first loads the original size pixbuf, and if the size is greater than the size of the cellrenderer we want to render it to, scales the full pixbuf down to that size, otherwise (in case the pixbuf is smaller than the size of the cell renderer) it leaves it at the original size. [1]

[1] http://git.xfce.org/xfce/thunar/tree/thunar/thunar-icon-renderer.c#n454

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

Definitely fixes the bug for me, Thanks Robert!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libcore/marlin-icon-info.c'
2--- libcore/marlin-icon-info.c 2013-08-10 20:20:23 +0000
3+++ libcore/marlin-icon-info.c 2014-03-12 23:57:23 +0000
4@@ -454,7 +454,10 @@
5 #endif
6 //#if 0
7 char *str_icon = g_icon_to_string (icon);
8- pixbuf = gdk_pixbuf_new_from_file_at_size (str_icon, size, size, NULL);
9+ gint width, height;
10+
11+ gdk_pixbuf_get_file_info (str_icon, &width, &height);
12+ pixbuf = gdk_pixbuf_new_from_file_at_size (str_icon, MIN (width, size), MIN (height, size), NULL);
13 /*icon_info = g_object_new (MARLIN_TYPE_ICON_INFO, NULL);
14 icon_info->pixbuf = pixbuf;*/
15 icon_info = marlin_icon_info_new_for_pixbuf (pixbuf);
16
17=== modified file 'src/marlin-icon-renderer.c'
18--- src/marlin-icon-renderer.c 2013-08-10 20:15:26 +0000
19+++ src/marlin-icon-renderer.c 2014-03-12 23:57:23 +0000
20@@ -402,7 +402,7 @@
21 yet, we can still determine its dimensions. This allow to asyncronously load the thumbnails
22 pixbuf */
23 int s = MAX (pixbuf_width, pixbuf_height);
24- priv->scale = (double)priv->size / s;
25+ priv->scale = MIN (1, (double)priv->size / s);
26
27 if (width)
28 *width = calc_width * priv->scale;

Subscribers

People subscribed via source and target branches

to all changes: