diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-01-27 14:30:42 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-01-27 14:30:42 +0800 |
commit | 803fc4da6978b404212cf233ad7dec740a1c6bd0 (patch) | |
tree | fb88e73f29742672dfff7060b23b5f235efa7f51 /shell/e-storage-set-view.c | |
parent | 38b37faf3692af41fff269e14514e3d34da86f0a (diff) | |
download | gsoc2013-evolution-803fc4da6978b404212cf233ad7dec740a1c6bd0.tar.gz gsoc2013-evolution-803fc4da6978b404212cf233ad7dec740a1c6bd0.tar.zst gsoc2013-evolution-803fc4da6978b404212cf233ad7dec740a1c6bd0.zip |
Fix the folder tree so that the icons don't look blurry anymore. (For
some reason, the `gdk_pixbuf_scale()' function seems to give me a
modified copy of the image even for a 1.0 scaling factor.)
svn path=/trunk/; revision=7848
Diffstat (limited to 'shell/e-storage-set-view.c')
-rw-r--r-- | shell/e-storage-set-view.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 32c55b279a..ef76d21903 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -190,6 +190,7 @@ get_pixbuf_for_folder (EStorageSetView *storage_set_view, EFolderTypeRegistry *folder_type_registry; EStorageSet *storage_set; GdkPixbuf *icon_pixbuf; + int icon_pixbuf_width, icon_pixbuf_height; storage_set = priv->storage_set; folder_type_registry = e_storage_set_get_folder_type_registry (storage_set); @@ -197,21 +198,27 @@ get_pixbuf_for_folder (EStorageSetView *storage_set_view, icon_pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry, type_name, TRUE); - if (icon_pixbuf == NULL) { + if (icon_pixbuf == NULL) return NULL; - } - scaled_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (icon_pixbuf), - gdk_pixbuf_get_has_alpha (icon_pixbuf), - gdk_pixbuf_get_bits_per_sample (icon_pixbuf), - E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE); - - gdk_pixbuf_scale (icon_pixbuf, scaled_pixbuf, - 0, 0, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, - 0.0, 0.0, - (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_width (icon_pixbuf), - (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_height (icon_pixbuf), - GDK_INTERP_HYPER); + icon_pixbuf_width = gdk_pixbuf_get_width (icon_pixbuf); + icon_pixbuf_height = gdk_pixbuf_get_height (icon_pixbuf); + + if (icon_pixbuf_width == E_SHELL_MINI_ICON_SIZE && icon_pixbuf_height == E_SHELL_MINI_ICON_SIZE) { + scaled_pixbuf = gdk_pixbuf_ref (icon_pixbuf); + } else { + scaled_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (icon_pixbuf), + gdk_pixbuf_get_has_alpha (icon_pixbuf), + gdk_pixbuf_get_bits_per_sample (icon_pixbuf), + E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE); + + gdk_pixbuf_scale (icon_pixbuf, scaled_pixbuf, + 0, 0, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, + 0.0, 0.0, + (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_width (icon_pixbuf), + (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_height (icon_pixbuf), + GDK_INTERP_HYPER); + } g_hash_table_insert (priv->type_name_to_pixbuf, g_strdup(type_name), scaled_pixbuf); } |