From 803fc4da6978b404212cf233ad7dec740a1c6bd0 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sat, 27 Jan 2001 06:30:42 +0000 Subject: 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 --- shell/ChangeLog | 6 ++++++ shell/e-storage-set-view.c | 33 ++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index f18c26ab4f..6ed321d8a1 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2001-01-27 Ettore Perazzoli + + * e-storage-set-view.c (get_pixbuf_for_folder): Don't scale if the + size is the same. `gdk_pixbuf_scale()' seems to be blurring the + image even if the scaling factor is 1.0. + 2001-01-26 Ettore Perazzoli * e-corba-storage.c: Remove all instances of `__FUNCTION__'. 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); } -- cgit