Fix the case "orientation from FileData, color profile from exif".
authorLaurent Monin <geeqie@norz.org>
Sun, 20 Apr 2008 09:02:05 +0000 (09:02 +0000)
committerLaurent Monin <geeqie@norz.org>
Sun, 20 Apr 2008 09:02:05 +0000 (09:02 +0000)
Reported by Vladimir Nadvornik.

src/image.c

index 85dca4d..bb0740c 100644 (file)
@@ -1300,19 +1300,27 @@ void image_change_pixbuf(ImageWindow *imd, GdkPixbuf *pixbuf, gdouble zoom)
 {
 
        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);