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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Nov 5 18:10:20 EET 2008
Author: pvanhoof
Date: 2008-11-05 18:10:17 +0200 (Wed, 05 Nov 2008)
New Revision: 16585

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

	* daemon/plugins/epeg-plugin.c: When the destination is larger
	than the source, EPeg behaves unexpected.



Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-thumbnail/ChangeLog	2008-11-05 15:27:33 UTC (rev 16584)
+++ projects/haf/trunk/hildon-thumbnail/ChangeLog	2008-11-05 16:10:17 UTC (rev 16585)
@@ -1,5 +1,10 @@
 2008-11-05  Philip Van Hoof  <philip at codeminded.be>
 
+	* daemon/plugins/epeg-plugin.c: When the destination is larger
+	than the source, EPeg behaves unexpected.
+
+2008-11-05  Philip Van Hoof  <philip at codeminded.be>
+
 	* daemon/albumart.c: Aways emit the finished and started signals
 
 2008-11-05  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	2008-11-05 15:27:33 UTC (rev 16584)
+++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c	2008-11-05 16:10:17 UTC (rev 16585)
@@ -216,8 +216,8 @@
 		gboolean just_crop;
 		GFileInfo *finfo = NULL;
 		GError *nerror = NULL;
+		guint ow, oh;
 
-
 		hildon_thumbnail_util_get_thumb_paths (uri, &large, &normal, 
 										   &cropped,
 										   NULL, NULL, NULL, do_pngs);
@@ -261,18 +261,36 @@
 			goto nerror_handler;
 		}
 
-		epeg_decode_colorspace_set (im, EPEG_RGB8);
-		epeg_decode_size_set (im, 256, 256);
-		epeg_quality_set (im, 80);
-		epeg_thumbnail_comments_enable (im, 0);
+		epeg_size_get (im, &ow, &oh);
 
-		data = (guchar *) epeg_pixels_get (im, 0, 0, 256, 256);
+		if (ow < 256 || oh < 256) {
 
-		pixbuf_large = gdk_pixbuf_new_from_data ((const guchar*) data, 
-								  GDK_COLORSPACE_RGB, FALSE, 
-								  8, 256, 256, 256*3,
-								  destroy_pixbuf, im);
+			/* Epeg doesn't behave as expected when the destination is larger
+			 * than the source */
 
+			pixbuf_large = gdk_pixbuf_new_from_file_at_size (path, 
+															 256, 256, 
+															 &nerror);
+			epeg_close (im);
+
+			if (nerror)
+				goto nerror_handler;
+
+		} else {
+
+			epeg_decode_colorspace_set (im, EPEG_RGB8);
+			epeg_decode_size_set (im, 256, 256);
+			epeg_quality_set (im, 80);
+			epeg_thumbnail_comments_enable (im, 0);
+
+			data = (guchar *) epeg_pixels_get (im, 0, 0, 256, 256);
+
+			pixbuf_large = gdk_pixbuf_new_from_data ((const guchar*) data, 
+									  GDK_COLORSPACE_RGB, FALSE, 
+									  8, 256, 256, 256*3,
+									  destroy_pixbuf, im);	
+		}
+
 		save_thumb_file_meta (pixbuf_large, large, mtime, uri, &nerror);
 
 		if (nerror)


More information about the maemo-commits mailing list