[gimp] Bug 637413 - Saving indexed png with transparency removes one unused color from the colormap



commit 8b29687353e38896bc8d5ee3e7d69ae0bf0f4471
Author: Alexis Wilhelm <alexiswilhelm gmail com>
Date:   Mon Mar 26 20:40:25 2012 +0200

    Bug 637413 - Saving indexed png with transparency removes one unused color from the colormap

 plug-ins/common/file-png.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index d3327f2..da894ea 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -2168,15 +2168,9 @@ find_unused_ia_color (GeglBuffer *buffer,
   if (trans_used == FALSE)
     return -1;
 
-  for (i = 0; i < *colors; i++)
-    {
-      if (ix_used[i] == FALSE)
-        return i;
-    }
-
-  /* Couldn't find an unused color index within the number of
-     bits per pixel we wanted.  Will have to increment the number
-     of colors in the image and assign a transparent pixel there. */
+  /* If there is still some room at the end of the palette, increment
+   * the number of colors in the image and assign a transparent pixel
+   * there. */
   if ((*colors) < 256)
     {
       (*colors)++;
@@ -2184,6 +2178,12 @@ find_unused_ia_color (GeglBuffer *buffer,
       return (*colors) - 1;
     }
 
+  for (i = 0; i < *colors; i++)
+    {
+      if (ix_used[i] == FALSE)
+        return i;
+    }
+
   return -1;
 }
 


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