[gimp/blend-tool-fun: 64/163] plug-ins: some cleanup in the new file-exr ICC profile code



commit 1e14e0218b62e1110f07e152a8369b5cae00f668
Author: Michael Natterer <mitch gimp org>
Date:   Sun Sep 20 23:49:38 2015 +0200

    plug-ins: some cleanup in the new file-exr ICC profile code

 plug-ins/file-exr/file-exr.c         |   15 +++++++++------
 plug-ins/file-exr/openexr-wrapper.cc |   14 +++++++-------
 plug-ins/file-exr/openexr-wrapper.h  |    6 +++---
 3 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/plug-ins/file-exr/file-exr.c b/plug-ins/file-exr/file-exr.c
index 9fda3c0..4f4eb8e 100644
--- a/plug-ins/file-exr/file-exr.c
+++ b/plug-ins/file-exr/file-exr.c
@@ -280,24 +280,27 @@ load_image (const gchar  *filename,
       gimp_progress_update ((gdouble) begin / (gdouble) height);
     }
 
-  // try to load an icc profile.
-  // this will be generated on the fly if chromaticities are given
+  /* try to load an icc profile, it will be generated on the fly if
+   * chromaticities are given
+   */
   if (image_type == GIMP_RGB)
     {
-      cmsHPROFILE       lcms_profile = NULL;
-      GimpColorProfile *profile      = NULL;
+      cmsHPROFILE lcms_profile;
 
-      lcms_profile = exr_loader_icc_read_profile (loader);
+      lcms_profile = exr_loader_get_icc_profile (loader);
       if (lcms_profile)
         {
+          GimpColorProfile *profile;
+
           profile = gimp_color_profile_new_from_lcms_profile (lcms_profile,
                                                               NULL);
+          cmsCloseProfile (lcms_profile);
+
           if (profile)
             {
               gimp_image_set_color_profile (image, profile);
               g_object_unref (profile);
             }
-          cmsCloseProfile (lcms_profile);
         }
     }
 
diff --git a/plug-ins/file-exr/openexr-wrapper.cc b/plug-ins/file-exr/openexr-wrapper.cc
index db0ce05..b7f46d0 100644
--- a/plug-ins/file-exr/openexr-wrapper.cc
+++ b/plug-ins/file-exr/openexr-wrapper.cc
@@ -170,7 +170,7 @@ struct _EXRLoader
     return has_alpha_ ? 1 : 0;
   }
 
-  cmsHPROFILE readICCProfile() const {
+  cmsHPROFILE getICCProfile() const {
     Chromaticities chromaticities;
     float whiteLuminance = 1.0;
 
@@ -340,6 +340,12 @@ exr_loader_has_alpha (EXRLoader *loader)
   return loader->hasAlpha();
 }
 
+cmsHPROFILE
+exr_loader_get_icc_profile (EXRLoader *loader)
+{
+  return loader->getICCProfile ();
+}
+
 int
 exr_loader_read_pixel_row (EXRLoader *loader,
                            char *pixels,
@@ -359,9 +365,3 @@ exr_loader_read_pixel_row (EXRLoader *loader,
 
   return retval;
 }
-
-cmsHPROFILE
-exr_loader_icc_read_profile (EXRLoader *loader)
-{
-  return loader->readICCProfile ();
-}
diff --git a/plug-ins/file-exr/openexr-wrapper.h b/plug-ins/file-exr/openexr-wrapper.h
index 7b3cd41..a89d3a5 100644
--- a/plug-ins/file-exr/openexr-wrapper.h
+++ b/plug-ins/file-exr/openexr-wrapper.h
@@ -50,15 +50,15 @@ exr_loader_get_image_type (EXRLoader *loader);
 int
 exr_loader_has_alpha (EXRLoader *loader);
 
+cmsHPROFILE
+exr_loader_get_icc_profile (EXRLoader *loader);
+
 int
 exr_loader_read_pixel_row (EXRLoader *loader,
                            char *pixels,
                            int bpp,
                            int row);
 
-cmsHPROFILE
-exr_loader_icc_read_profile (EXRLoader *loader);
-
 #ifdef __cplusplus
 }
 #endif


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