[gimp/goat-invasion] ==== Better byteswapping plus stupid bug-workaround ====



commit 6d272bc8c36f6f853176ba2986b76ea0be4b69c1
Author: Simon Budig <simon budig de>
Date:   Fri Apr 27 01:01:05 2012 +0200

    ====   Better byteswapping plus stupid bug-workaround  ====

 plug-ins/common/file-png.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 042be81..68f7b21 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -788,10 +788,12 @@ load_image (const gchar  *filename,
 
   if (png_get_bit_depth (pp, info) == 16)
     {
-      png_set_swap (pp);
       have_u16 = 1;
     }
 
+  if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
+    png_set_swap (pp);
+
   if (png_get_color_type (pp, info) == PNG_COLOR_TYPE_GRAY &&
       png_get_bit_depth (pp, info) < 8)
     {
@@ -1401,6 +1403,9 @@ save_image (const gchar  *filename,
   height = gegl_buffer_get_height (buffer);
   type = gimp_drawable_type (drawable_ID);
 
+  /* this is a stupid workaround for some caching issues in GEGL */
+  gegl_buffer_copy (buffer, NULL, buffer, NULL);
+
   /*
    * Initialise remap[]
    */
@@ -1621,8 +1626,9 @@ save_image (const gchar  *filename,
   if (text)
     png_set_text (pp, info, text, 1);
 
-  // png_set_swap (pp);
   png_write_info (pp, info);
+  if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
+    png_set_swap (pp);
 
   /*
    * Turn on interlace handling...



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