[gimp] plug-ins: in file-png, pass a more correct SAVE_COLOR_PROFILE flag...



commit aa02d619f77c6dec09e5d1679a75df5d527a0879
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jan 2 13:18:32 2019 +0100

    plug-ins: in file-png, pass a more correct SAVE_COLOR_PROFILE flag...
    
    ...to gimp_image_metadata_save_finish(). Set it based on whether the
    profile was actually saved, not if we only intended to save it.

 plug-ins/common/file-png.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index e26ec5d7e9..92f2c35e20 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -163,6 +163,7 @@ static gboolean  save_image                (const gchar      *filename,
                                             gint32            image_ID,
                                             gint32            drawable_ID,
                                             gint32            orig_image_ID,
+                                            gboolean         *profile_saved,
                                             GError          **error);
 
 static int       respin_cmap               (png_structp       pp,
@@ -630,8 +631,11 @@ run (const gchar      *name,
 
       if (status == GIMP_PDB_SUCCESS)
         {
+          gboolean profile_saved = FALSE;
+
           if (save_image (param[3].data.d_string,
-                          image_ID, drawable_ID, orig_image_ID, &error))
+                          image_ID, drawable_ID, orig_image_ID,
+                          &profile_saved, &error))
             {
               if (metadata)
                 {
@@ -659,7 +663,10 @@ run (const gchar      *name,
                   else
                     metadata_flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
 
-                  if (pngvals.save_profile)
+                  /* check if the profile was actually saved, not only
+                   * if we wanted to save it
+                   */
+                  if (profile_saved)
                     metadata_flags |= GIMP_METADATA_SAVE_COLOR_PROFILE;
                   else
                     metadata_flags &= ~GIMP_METADATA_SAVE_COLOR_PROFILE;
@@ -1466,6 +1473,7 @@ save_image (const gchar  *filename,
             gint32        image_ID,
             gint32        drawable_ID,
             gint32        orig_image_ID,
+            gboolean     *profile_saved,
             GError      **error)
 {
   gint              i, k;             /* Looping vars */
@@ -1864,6 +1872,8 @@ save_image (const gchar  *filename,
       g_free (profile_name);
 
       g_object_unref (profile);
+
+      *profile_saved = TRUE;
     }
 #endif
 


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