changeset 434:1b0aee2b162e

Keep image orientation set by the user during the session.
author zas_
date Sat, 19 Apr 2008 21:50:05 +0000
parents 5ddcf93278c7
children 6802aeeed196
files src/image.c src/typedefs.h
diffstat 2 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sat Apr 19 21:30:19 2008 +0000
+++ b/src/image.c	Sat Apr 19 21:50:05 2008 +0000
@@ -587,6 +587,18 @@
 			return;
 			break;
 		}
+
+	if (type != ALTER_NONE && type != ALTER_DESATURATE)
+		{
+		if (imd->image_fd->user_orientation == 0) file_data_ref(imd->image_fd);
+		imd->image_fd->user_orientation = imd->orientation;
+		}
+	else
+		{
+		if (imd->image_fd->user_orientation != 0) file_data_unref(imd->image_fd);
+		imd->image_fd->user_orientation = 0;
+		}
+
 	pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
 	if (imd->cm || imd->desaturate) 
 		pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) );
@@ -1290,17 +1302,19 @@
 	ExifData *exif = NULL;
 	gint orientation;
 
-	if (options->image.exif_rotate_enable ||
+	if (imd->image_fd && imd->image_fd->user_orientation)
+		imd->orientation = imd->image_fd->user_orientation;
+	else if (options->image.exif_rotate_enable ||
 	    (imd->color_profile_enable && imd->color_profile_use_image) )
 		{
 		exif = exif_read_fd(imd->image_fd, (imd->color_profile_enable && imd->color_profile_use_image));
+		
+		if (options->image.exif_rotate_enable && exif && exif_get_integer(exif, "Exif.Image.Orientation", &orientation)) 
+			imd->orientation = orientation;
+		else
+			imd->orientation = 1;
 		}
 
-	if (options->image.exif_rotate_enable && exif && exif_get_integer(exif, "Exif.Image.Orientation", &orientation)) 
-		imd->orientation = orientation;
-	else
-		imd->orientation = 1;
-
 	pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, FALSE);
 	if (imd->cm) 
 		{
--- a/src/typedefs.h	Sat Apr 19 21:30:19 2008 +0000
+++ b/src/typedefs.h	Sat Apr 19 21:50:05 2008 +0000
@@ -411,6 +411,7 @@
 	FileDataChangeInfo *change; /* for rename, move ... */
 	GdkPixbuf *pixbuf;
 	gint ref;
+	gint user_orientation;
 };
 
 struct _LayoutWindow