[PATCH] Do not scale up small images in icon view



Nautilus scales up small images such a icons of 16x16 pixels. When they get scaled up they look very blurry and also do not give a good indication how large they actually are compared to the other items in the preview

Bug in bugzilla: http://bugzilla.gnome.org/show_bug.cgi?id=153072
Screenshot showing the problem:
http://bugzilla.gnome.org/attachment.cgi?id=34294&action=view
Notice that the icon of 16x16 looks to have the same size as the 24x24

Screenshot after the patch:
http://bugzilla.gnome.org/attachment.cgi?id=34296&action=view

The attached patch corrects this problem. It only removes code, so as an extra plus total codesize is getting smaller and also nautilus get's a bit speedier loading small images

Jaap


Index: nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.378
diff -u -p -r1.378 nautilus-icon-container.c
--- nautilus-icon-container.c	29 Oct 2004 12:02:13 -0000	1.378
+++ nautilus-icon-container.c	29 Nov 2004 19:33:29 -0000
@@ -4938,11 +4938,9 @@ nautilus_icon_container_update_icon (Nau
 	NautilusIconContainerDetails *details;
 	guint icon_size;
 	guint min_image_size, max_image_size;
-	guint width, height, scaled_width, scaled_height;
-	double scale_factor;
 	char *icon_name;
 	NautilusEmblemAttachPoints attach_points;
-	GdkPixbuf *pixbuf, *emblem_pixbuf, *saved_pixbuf;
+	GdkPixbuf *pixbuf, *emblem_pixbuf;
 	GList *emblem_icon_names, *emblem_pixbufs, *p;
 	char *editable_text, *additional_text;
 	char *embedded_text;
@@ -5001,22 +4999,6 @@ nautilus_icon_container_update_icon (Nau
 		nautilus_icon_container_start_monitor_top_left (container, icon->data, icon);
 	}
 	
-	/* in the rare case an image is too small, scale it up */
-	width = gdk_pixbuf_get_width (pixbuf);
-	height = gdk_pixbuf_get_height (pixbuf);
-	if (width < min_image_size && height < min_image_size) {
-		scale_factor = MAX (min_image_size  / (double) width, min_image_size / (double) height);
-		/* don't let it exceed the maximum width in the other dimension */
-		scale_factor = MIN (scale_factor, max_image_size / width);
-		scale_factor = MIN (scale_factor, max_image_size / height);
-		
-		scaled_width  = floor (width * scale_factor + .5);
-		scaled_height = floor (height * scale_factor + .5);
-		saved_pixbuf = pixbuf;
-		pixbuf = gdk_pixbuf_scale_simple (pixbuf, scaled_width, scaled_height, GDK_INTERP_BILINEAR);
-		g_object_unref (saved_pixbuf);
-	}
-		
 	emblem_pixbufs = NULL;
 	
 	icon_size = MAX (nautilus_get_icon_size_for_zoom_level (container->details->zoom_level)


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