[PATCH] Don't scale icons if not required (was: [PATCH] Add compact icon view (column-wise))



Am Samstag, den 16.02.2008, 21:59 +0100 schrieb Christian Neumair:
> I dediced to do some balancing computer hacking between two written
> tests. I'm attaching the results, namely a "compact icon view" - I'm not
> sure whether that name is verbose enough.
> 
> It provides a column-wise icon layout with tiny icons and one-lined text
> descriptions next to the icons. It allows to display a few dozen icons
> at the same time, which may make it interesting for people with much
> data (like myself).
> 
> To make review a little bit easier (it's a nightmare anyway), I made a
> patchset with 3 single patches: (...)

Here is another patch which ensures that icons are only scaled if
required. It will ensure that the icons don't look blurry unless they
are scaled, when their size is forced.

best regards,
 Christian

-- 
Christian Neumair <cneumair gnome org>
Index: libnautilus-private/nautilus-icon-info.c
===================================================================
--- libnautilus-private/nautilus-icon-info.c	(Revision 13749)
+++ libnautilus-private/nautilus-icon-info.c	(Arbeitskopie)
@@ -487,6 +487,10 @@ nautilus_icon_info_get_pixbuf_nodefault_
 	w = gdk_pixbuf_get_width (pixbuf);
 	h = gdk_pixbuf_get_height (pixbuf);
 	s = MAX (w, h);
+	if (s == forced_size) {
+		return pixbuf;
+	}
+
 	scale = (double)forced_size / s;
 	scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
 						 w * scale, h * scale,
@@ -509,6 +513,10 @@ nautilus_icon_info_get_pixbuf_at_size (N
 	w = gdk_pixbuf_get_width (pixbuf);
 	h = gdk_pixbuf_get_height (pixbuf);
 	s = MAX (w, h);
+	if (s == forced_size) {
+		return pixbuf;
+	}
+
 	scale = (double)forced_size / s;
 	scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
 						 w * scale, h * scale,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]