[gimp] plug-ins: verify that GimpColorConfig.rgb_profile is actually for RGB



commit a0e8913a43047a185107f03fbb630eb9b53811cc
Author: Michael Natterer <mitch gimp org>
Date:   Sun Mar 23 21:24:08 2014 +0100

    plug-ins: verify that GimpColorConfig.rgb_profile is actually for RGB
    
    and remove the RGB check from all callers of lcms_image_get_profile(),
    the function now returns an RGB profile or NULL. This implicitly stop
    checking that 'icc-profile' actually contains an RGB profile.

 plug-ins/common/lcms.c |   36 +++++++++---------------------------
 1 files changed, 9 insertions(+), 27 deletions(-)
---
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index 54e8285..3c8637e 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -573,15 +573,6 @@ lcms_icc_apply (GimpColorConfig          *config,
       g_clear_error (&error);
     }
 
-  if (src_profile && ! gimp_lcms_profile_is_rgb (src_profile))
-    {
-      g_printerr ("lcms: attached color profile is not for RGB color space "
-                  "(skipping)\n");
-
-      cmsCloseProfile (src_profile);
-      src_profile = NULL;
-    }
-
   if (! src_profile && ! dest_profile)
     return GIMP_PDB_SUCCESS;
 
@@ -656,15 +647,6 @@ lcms_icc_info (GimpColorConfig *config,
       g_clear_error (&error);
     }
 
-  if (profile && ! gimp_lcms_profile_is_rgb (profile))
-    {
-      g_printerr ("lcms: attached color profile is not for RGB color space "
-                  "(skipping)\n");
-
-      cmsCloseProfile (profile);
-      profile = NULL;
-    }
-
   if (! profile)
     profile = gimp_lcms_create_srgb_profile ();
 
@@ -748,6 +730,15 @@ lcms_image_get_profile (GimpColorConfig  *config,
     {
       profile = gimp_lcms_profile_open_from_file (config->rgb_profile,
                                                   checksum, error);
+
+      if (profile && ! gimp_lcms_profile_is_rgb (profile))
+        {
+          g_set_error (error, 0, 0,
+                       _("Color profile '%s' is not for RGB color space"),
+                       gimp_filename_to_utf8 (config->rgb_profile));
+          cmsCloseProfile (profile);
+          profile = NULL;
+        }
     }
 
   return profile;
@@ -1399,15 +1390,6 @@ lcms_dialog (GimpColorConfig *config,
       g_clear_error (&error);
     }
 
-  if (src_profile && ! gimp_lcms_profile_is_rgb (src_profile))
-    {
-      g_printerr ("lcms: attached color profile is not for RGB color space "
-                  "(skipping)\n");
-
-      cmsCloseProfile (src_profile);
-      src_profile = NULL;
-    }
-
   if (! src_profile)
     src_profile = gimp_lcms_create_srgb_profile ();
 


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