[gthumb] apply embedded orientation to pixbufs where appropriate



commit 71dd9d76d80a018d91c3fb8a0024cdbfb551032f
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Mar 30 00:07:33 2010 +0200

    apply embedded orientation to pixbufs where appropriate

 extensions/picasaweb/dlg-import-from-picasaweb.c |   10 +++++++++-
 gthumb/gth-pixbuf-list-task.c                    |   10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.c b/extensions/picasaweb/dlg-import-from-picasaweb.c
index 7159e91..1f79d33 100644
--- a/extensions/picasaweb/dlg-import-from-picasaweb.c
+++ b/extensions/picasaweb/dlg-import-from-picasaweb.c
@@ -839,9 +839,17 @@ picasa_web_thumbnail_loader (GthFileData  *file_data,
 
 			stream = g_memory_input_stream_new_from_data (buffer, size, g_free);
 			pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, error);
-			if (pixbuf != NULL)
+			if (pixbuf != NULL) {
+				GdkPixbuf *rotated;
+
+				rotated = gdk_pixbuf_apply_embedded_orientation (pixbuf);
+				g_object_unref (pixbuf);
+				pixbuf = rotated;
+
 				animation = gdk_pixbuf_non_anim_new (pixbuf);
+			}
 
+			g_object_unref (pixbuf);
 			g_object_unref (stream);
 		}
 
diff --git a/gthumb/gth-pixbuf-list-task.c b/gthumb/gth-pixbuf-list-task.c
index f6d8c27..47aa5b1 100644
--- a/gthumb/gth-pixbuf-list-task.c
+++ b/gthumb/gth-pixbuf-list-task.c
@@ -334,6 +334,7 @@ file_buffer_ready_cb (void     **buffer,
 {
 	GthPixbufListTask *self = user_data;
 	GInputStream      *istream;
+	GdkPixbuf         *pixbuf;
 
 	if (error != NULL) {
 		gth_task_completed (GTH_TASK (self), error);
@@ -341,7 +342,14 @@ file_buffer_ready_cb (void     **buffer,
 	}
 
 	istream = g_memory_input_stream_new_from_data (*buffer, count, NULL);
-	self->priv->original_pixbuf = gdk_pixbuf_new_from_stream (istream, gth_task_get_cancellable (GTH_TASK (self)), &error);
+	pixbuf = gdk_pixbuf_new_from_stream (istream, gth_task_get_cancellable (GTH_TASK (self)), &error);
+	if (pixbuf != NULL) {
+		self->priv->original_pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf);
+		g_object_unref (pixbuf);
+	}
+	else
+		self->priv->original_pixbuf = NULL;
+
 	g_object_unref (istream);
 
 	if (self->priv->original_pixbuf == NULL) {



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