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

[E-devel] epsilon patch



Hey,

I'm not sure if this patch is correct but here goes. Currently if epsilon gets an image that is smaller then it's thumb size it will scale the image up to the thumb size. The attached patch stops this and makes the thumbnail the same size as the original image (hence no scaling) if the image is smaller then the thumbnail size.

It is working for me, but like I said, I'm not sure if this is the desired behaviour or not.

Thanks,
dan


Index: src/lib/Epsilon.c
===================================================================
RCS file: /cvs/e/e17/libs/epsilon/src/lib/Epsilon.c,v
retrieving revision 1.28
diff -u -r1.28 Epsilon.c
--- src/lib/Epsilon.c	20 May 2006 10:24:03 -0000	1.28
+++ src/lib/Epsilon.c	31 May 2006 00:49:34 -0000
@@ -551,6 +551,14 @@
 	{
 	  tw = e->tw * ((double) iw / (double) ih);
 	}
+
+      /* if the image is smaller then the thumb, just use the image size */
+      if ((tw > iw) && (th > ih))
+	{
+	  tw = iw;
+	  th = ih;
+	}
+
       epeg_decode_size_set (im, tw, th);
       epeg_quality_set (im, 100);
       epeg_thumbnail_comments_enable (im, 1);
@@ -659,6 +667,14 @@
 	  {
 	    tw = e->tw * ((double) iw / (double) ih);
 	  }
+
+	/* if the image is smaller then the thumb, just use the image size */
+	if ((tw > iw) && (th > ih))
+	  {
+	    tw = iw;
+	    th = ih;
+	  }
+
 	imlib_context_set_cliprect (0, 0, tw, th);
 	if ((src = imlib_create_cropped_scaled_image (0, 0, iw, ih, tw, th)))
 	  {