[maemo-commits] [maemo-commits] r18661 - in projects/haf/trunk/hildon-thumbnail: . daemon/plugins thumbs
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Jun 8 17:12:29 EEST 2009
- Previous message: [maemo-commits] r18660 - in projects/haf/trunk/hildon-thumbnail: . daemon/plugins thumbs
- Next message: [maemo-commits] r18662 - projects/haf/trunk/hildon-thumbnail
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: pvanhoof Date: 2009-06-08 17:12:23 +0300 (Mon, 08 Jun 2009) New Revision: 18661 Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-obj.c Log: 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 Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog =================================================================== --- projects/haf/trunk/hildon-thumbnail/ChangeLog 2009-06-08 13:57:04 UTC (rev 18660) +++ projects/haf/trunk/hildon-thumbnail/ChangeLog 2009-06-08 14:12:23 UTC (rev 18661) @@ -1,6 +1,12 @@ 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 + +2009-06-08 Philip Van Hoof <philip at codeminded.be> + + * thumbs/hildon-thumbnail-obj.c * daemon/plugins/gdkpixbuf-plugin.c * daemon/plugins/pixbuf-io-loader.c: Ensure that we use our own pixbuf loaders Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c 2009-06-08 13:57:04 UTC (rev 18660) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c 2009-06-08 14:12:23 UTC (rev 18661) @@ -45,7 +45,25 @@ #include <hildon-thumbnail-plugin.h> +#ifdef HAVE_OSSO +#define MAX_SIZE (1024*1024*5) +#else +#define MAX_SIZE (1024*1024*100) +#endif +GdkPixbuf * +my_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream, + gint width, + gint height, + gboolean preserve_aspect_ratio, + GCancellable *cancellable, + GError **error); + +GdkPixbuf * +my_gdk_pixbuf_new_from_stream (GInputStream *stream, + GCancellable *cancellable, + GError **error); + static gchar **supported = NULL; static gboolean do_cropped = TRUE; static GFileMonitor *monitor = NULL; @@ -98,7 +116,7 @@ GdkPixbuf *pixbuf_large; GdkPixbuf *pixbuf_normal; GdkPixbuf *pixbuf, *pixbuf_cropped; - guint64 mtime; + guint64 mtime, msize; const guchar *rgb8_pixels; guint width; guint height; guint rowstride; @@ -106,13 +124,22 @@ file = g_file_new_for_uri (uri); - info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, + info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED "," + G_FILE_ATTRIBUTE_STANDARD_SIZE, G_FILE_QUERY_INFO_NONE, NULL, &nerror); if (nerror) goto nerror_handler; + msize = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE); + + if (msize > MAX_SIZE) { + g_set_error (&nerror, DEFAULT_ERROR, 0, "%s is too large", + uri); + goto nerror_handler; + } + mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED); if ( Modified: projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-obj.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-obj.c 2009-06-08 13:57:04 UTC (rev 18660) +++ projects/haf/trunk/hildon-thumbnail/thumbs/hildon-thumbnail-obj.c 2009-06-08 14:12:23 UTC (rev 18661) @@ -58,6 +58,19 @@ } HildonThumbnailFactoryPrivate; +GdkPixbuf * +my_gdk_pixbuf_new_from_stream (GInputStream *stream, + GCancellable *cancellable, + GError **error); +GdkPixbuf * +my_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream, + gint width, + gint height, + gboolean preserve_aspect_ratio, + GCancellable *cancellable, + GError **error); + + #define HILDON_THUMBNAIL_APPLICATION "hildon-thumbnail" #define FACTORY_ERROR g_quark_from_static_string (HILDON_THUMBNAIL_APPLICATION)
- Previous message: [maemo-commits] r18660 - in projects/haf/trunk/hildon-thumbnail: . daemon/plugins thumbs
- Next message: [maemo-commits] r18662 - projects/haf/trunk/hildon-thumbnail
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]