[maemo-commits] [maemo-commits] r18671 - in projects/haf/trunk/hildon-thumbnail: . daemon/plugins

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jun 9 11:33:34 EEST 2009
Author: pvanhoof
Date: 2009-06-09 11:33:23 +0300 (Tue, 09 Jun 2009)
New Revision: 18671

Modified:
   projects/haf/trunk/hildon-thumbnail/ChangeLog
   projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c
Log:
2009-06-09  Philip Van Hoof  <philip at codeminded.be>

        * daemon/plugins/epeg-plugin.c: Cropped sizes. NB#118963




Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-thumbnail/ChangeLog	2009-06-09 06:51:57 UTC (rev 18670)
+++ projects/haf/trunk/hildon-thumbnail/ChangeLog	2009-06-09 08:33:23 UTC (rev 18671)
@@ -1,8 +1,12 @@
+2009-06-09  Philip Van Hoof  <philip at codeminded.be>
+
+	* daemon/plugins/epeg-plugin.c: Cropped sizes. NB#118963
+
 2009-06-08  Philip Van Hoof  <philip at codeminded.be>
 
 	* thumbs/hildon-thumbnail-obj.c
-	* daemon/plugins/gdkpixbuf-plugin.c: Refuse to make thumbnails for images
-	 that are too large. NB#121200
+	* daemon/plugins/gdkpixbuf-plugin.c: Refuse to make thumbnails for 
+	  images that are too large. NB#121200
 
 2009-06-08  Philip Van Hoof  <philip at codeminded.be>
 

Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c	2009-06-09 06:51:57 UTC (rev 18670)
+++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c	2009-06-09 08:33:23 UTC (rev 18671)
@@ -421,14 +421,30 @@
 
 		// printf ("%dx%d -> %dx%d\n", ow, oh, ww, wh);
 
-		if (ow < 256 || oh < 256) {
+		// Only cropped will work with this currently ugly looking, 
+		// often changed exception code
+
+		if (ow < 124 || oh < 124) {
+
 			/* Epeg doesn't behave as expected when the destination is larger
 			 * than the source */
 
-			pixbuf_large1 = gdk_pixbuf_new_from_file_at_scale (path, 
-									 256, 256, 
-									  TRUE,
-									 &nerror);
+			if (ow < 124 && oh < 124) {
+				// If both are smaller, no cropping (crop_resize
+				// will take care of this one)
+
+				pixbuf_large1 = gdk_pixbuf_new_from_file (path,
+									  &nerror);
+			} else {
+				// if one of both is smaller, first upscale for
+				// both to become larger, then normal crop
+
+				pixbuf_large1 = gdk_pixbuf_new_from_file_at_scale (path, 
+										 256, 256, 
+										  TRUE,
+										 &nerror);
+			}
+
 			epeg_close (im);
 
 			if (nerror) {
@@ -437,6 +453,8 @@
 			}
 
 		} else {
+			// if both are larger, normal crop
+
 			//gchar *large=NULL, *normal=NULL, *cropped=NULL;
 
 			epeg_decode_colorspace_set (im, EPEG_RGB8);


More information about the maemo-commits mailing list