[gimp/gimp-2-10] plug-ins: in file-psd, use normal channel order



commit 9ee2b6685e9d8cebda7686406f5b9e7806e69d0a
Author: Ell <ell_se yahoo com>
Date:   Sun Apr 26 23:31:50 2020 +0300

    plug-ins: in file-psd, use normal channel order
    
    For some reason we reverse the channel order when loading/saving a
    PSD file.  This doesn't seem to be necessary, and leads to a
    reversed channel order across GIMP/Photoshop.  Simply use the
    normal channel order instead.

 plug-ins/file-psd/psd-load.c | 2 +-
 plug-ins/file-psd/psd-save.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index 972b3c367d..25b08a9fc4 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -2087,7 +2087,7 @@ add_merged_image (gint32     image_id,
           channel_id = gimp_channel_new (image_id, alpha_name,
                                          chn_a[cidx].columns, chn_a[cidx].rows,
                                          alpha_opacity, &alpha_rgb);
-          gimp_image_insert_channel (image_id, channel_id, -1, 0);
+          gimp_image_insert_channel (image_id, channel_id, -1, i);
           g_free (alpha_name);
           buffer = gimp_drawable_get_buffer (channel_id);
           if (alpha_id)
diff --git a/plug-ins/file-psd/psd-save.c b/plug-ins/file-psd/psd-save.c
index f418c22d59..c125d86afa 100644
--- a/plug-ins/file-psd/psd-save.c
+++ b/plug-ins/file-psd/psd-save.c
@@ -674,7 +674,7 @@ save_resources (FILE   *fd,
       if (gimp_drawable_has_alpha (PSDImageData.merged_layer))
         write_string (fd, "Transparency", "channel name");
 
-      for (i = PSDImageData.nChannels - 1; i >= 0; i--)
+      for (i = 0; i < PSDImageData.nChannels; i++)
         {
           char *chName = gimp_item_get_name (PSDImageData.lChannels[i]);
           write_string (fd, chName, "channel name");
@@ -736,7 +736,7 @@ save_resources (FILE   *fd,
           write_gchar  (fd, 1,                     "channel mode");
         }
 
-      for (i = PSDImageData.nChannels - 1; i >= 0; i--)
+      for (i = 0; i < PSDImageData.nChannels; i++)
         {
           GimpRGB color;
           gdouble opacity;
@@ -1565,7 +1565,7 @@ save_data (FILE   *fd,
   chan = nChansLayer (PSDImageData.baseType,
                       gimp_drawable_has_alpha(PSDImageData.merged_layer), 0);
 
-  for (i = PSDImageData.nChannels - 1; i >= 0; i--)
+  for (i = 0; i < PSDImageData.nChannels; i++)
     {
       IFDBG printf ("\t\tWriting compressed channel data for channel %d\n",
                     i);


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