[PATCH]Images of the same size are displayed with a different size in the preview



Nautilus currently does not always display images which have the same
size with the same size in the icon view. This is because small files
(i.e. filesize < 32K) are shown as themselves and no thumbnail is stored
of these files.

See bug http://bugzilla.gnome.org/show_bug.cgi?id=153073

The attached patch solves this problem. Small files which are actually
large images are now rendered at the same size as a thumbnail. Images
smaller then the current icon size are rendered as they used to be. And
finally images in between the icon size and the thumbnail size are
rendered in the appriate size in between the icon size and thumbnail size.
As a picture says more then a million words: ( the digits in the filename indicate the the image size)

Image before applying the patch:
http://bugzilla.gnome.org/attachment.cgi?id=34297&action=view
Image after applying the patch:
http://bugzilla.gnome.org/attachment.cgi?id=34298&action=view


Jaap




Index: nautilus-icon-factory.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-factory.c,v
retrieving revision 1.308
diff -u -p -r1.308 nautilus-icon-factory.c
--- nautilus-icon-factory.c	22 Nov 2004 15:24:36 -0000	1.308
+++ nautilus-icon-factory.c	29 Nov 2004 20:09:29 -0000
@@ -1142,8 +1142,11 @@ load_icon_file (const char    *filename,
 				width = gdk_pixbuf_get_width (pixbuf); 
 				height = gdk_pixbuf_get_height (pixbuf);
 				size = MAX (width, height);
-				if (size > NAUTILUS_ICON_SIZE_STANDARD + 5) {
-					base_size = size;
+                                if (size >  nominal_size * NAUTILUS_ICON_SIZE_THUMBNAIL / NAUTILUS_ICON_SIZE_STANDARD) {
+                                        base_size = size * NAUTILUS_ICON_SIZE_STANDARD / NAUTILUS_ICON_SIZE_THUMBNAIL;
+                                }
+                                else if (size > NAUTILUS_ICON_SIZE_STANDARD) {
+					base_size = nominal_size;
 				} else {
 					/* Don't scale up small icons */
 					base_size = NAUTILUS_ICON_SIZE_STANDARD;


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