Revision: 1453
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1453&view=rev
Author:   zas_
Date:     2009-03-01 15:54:37 +0000 (Sun, 01 Mar 2009)

Log Message:
-----------
image_post_process_color(): remove exif parameter, just extract it when needed.

Modified Paths:
--------------
    trunk/src/image.c

Modified: trunk/src/image.c
===================================================================
--- trunk/src/image.c   2009-03-01 15:41:51 UTC (rev 1452)
+++ trunk/src/image.c   2009-03-01 15:54:37 UTC (rev 1453)
@@ -189,7 +189,7 @@
  *-------------------------------------------------------------------
  */
 
-static gint image_post_process_color(ImageWindow *imd, gint start_row, 
ExifData *exif, gint run_in_bg)
+static gint image_post_process_color(ImageWindow *imd, gint start_row, gint 
run_in_bg)
 {
        ColorMan *cm;
        ColorManProfileType input_type;
@@ -239,44 +239,53 @@
                }
        imd->color_profile_from_image = COLOR_PROFILE_NONE;
 
-       if (imd->color_profile_use_image && exif)
+       if (imd->color_profile_use_image)
                {
-               profile = exif_get_color_profile(exif, &profile_len);
-               if (!profile)
+               ExifData *exif = exif_read_fd(imd->image_fd);
+               
+               if (exif)
                        {
-                       gint cs;
-                       gchar *interop_index;
+                       profile = exif_get_color_profile(exif, &profile_len);
+                       if (!profile)
+                               {
+                               gint cs;
+                               gchar *interop_index;
 
-                       /* ColorSpace == 1 specifies sRGB per EXIF 2.2 */
-                       if (!exif_get_integer(exif, "Exif.Photo.ColorSpace", 
&cs)) cs = 0;
-                       interop_index = exif_get_data_as_text(exif, 
"Exif.Iop.InteroperabilityIndex");
+                               /* ColorSpace == 1 specifies sRGB per EXIF 2.2 
*/
+                               if (!exif_get_integer(exif, 
"Exif.Photo.ColorSpace", &cs)) cs = 0;
+                               interop_index = exif_get_data_as_text(exif, 
"Exif.Iop.InteroperabilityIndex");
 
-                       if (cs == 1)
-                               {
-                               input_type = COLOR_PROFILE_SRGB;
-                               input_file = NULL;
-                               imd->color_profile_from_image = 
COLOR_PROFILE_SRGB;
+                               if (cs == 1)
+                                       {
+                                       input_type = COLOR_PROFILE_SRGB;
+                                       input_file = NULL;
+                                       imd->color_profile_from_image = 
COLOR_PROFILE_SRGB;
 
-                               DEBUG_1("Found EXIF ColorSpace of sRGB");
+                                       DEBUG_1("Found EXIF ColorSpace of 
sRGB");
+                                       }
+                               if (cs == 2 || (interop_index && 
!strcmp(interop_index, "R03")))
+                                       {
+                                       input_type = COLOR_PROFILE_ADOBERGB;
+                                       input_file = NULL;
+                                       imd->color_profile_from_image = 
COLOR_PROFILE_ADOBERGB;
+
+                                       DEBUG_1("Found EXIF ColorSpace of 
AdobeRGB");
+                                       }
+
+                               g_free(interop_index);
                                }
-                       if (cs == 2 || (interop_index && !strcmp(interop_index, 
"R03")))
+                       else
                                {
-                               input_type = COLOR_PROFILE_ADOBERGB;
-                               input_file = NULL;
-                               imd->color_profile_from_image = 
COLOR_PROFILE_ADOBERGB;
-
-                               DEBUG_1("Found EXIF ColorSpace of AdobeRGB");
+                               DEBUG_1("Found embedded color profile");
+                               imd->color_profile_from_image = 
COLOR_PROFILE_MEM;
                                }
-
-                       g_free(interop_index);
+                       
+                       exif_free_fd(imd->image_fd, exif);
                        }
                }
 
        if (profile)
                {
-               DEBUG_1("Found embedded color profile");
-               imd->color_profile_from_image = COLOR_PROFILE_MEM;
-
                cm = color_man_new_embedded(run_in_bg ? imd : NULL, NULL,
                                            profile, profile_len,
                                            screen_type, screen_file);
@@ -1039,17 +1048,7 @@
 
        if (imd->color_profile_enable)
                {
-               ExifData *exif = NULL;
-
-               if (imd->color_profile_use_image) exif = 
exif_read_fd(imd->image_fd);
-
-               if (!image_post_process_color(imd, 0, exif, FALSE))
-                       {
-                       /* fixme: note error to user */
-//                     image_state_set(imd, IMAGE_STATE_COLOR_ADJ);
-                       }
-               if (exif) exif_free_fd(imd->image_fd, exif);
-
+               image_post_process_color(imd, 0, FALSE); /* TODO: error 
handling */
                }
 
        if (imd->cm || imd->desaturate)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to