changeset 437:f707aa712b1f

Fix the case "orientation from FileData, color profile from exif". Reported by Vladimir Nadvornik.
author zas_
date Sun, 20 Apr 2008 09:02:05 +0000
parents f0289d80ecc1
children eff049b3d308
files src/image.c
diffstat 1 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sat Apr 19 23:12:30 2008 +0000
+++ b/src/image.c	Sun Apr 20 09:02:05 2008 +0000
@@ -1300,19 +1300,27 @@
 {
 
 	ExifData *exif = NULL;
-	gint orientation;
+	gint read_exif_for_color_profile = (imd->color_profile_enable && imd->color_profile_use_image);
+	gint read_exif_for_orientation = FALSE;
 
 	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) )
+	else if (options->image.exif_rotate_enable)
+		read_exif_for_orientation = TRUE;
+	
+	if (read_exif_for_color_profile || read_exif_for_orientation)
 		{
-		exif = exif_read_fd(imd->image_fd, (imd->color_profile_enable && imd->color_profile_use_image));
+		gint orientation;
+
+		exif = exif_read_fd(imd->image_fd, read_exif_for_color_profile);
 		
-		if (options->image.exif_rotate_enable && exif && exif_get_integer(exif, "Exif.Image.Orientation", &orientation)) 
-			imd->orientation = orientation;
-		else
-			imd->orientation = 1;
+		if (exif && read_exif_for_orientation)
+			{
+			if (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);