[gimp/wip/xcf-delta-compression: 859/859] app: add GIMP_XCF_NO_DELTA_COMPRESSION environment flag



commit 3a10fa0b2379e0771de3db1b5e3120541501d1f6
Author: Ell <ell_se yahoo com>
Date:   Fri Jul 7 21:23:25 2017 -0400

    app: add GIMP_XCF_NO_DELTA_COMPRESSION environment flag
    
    When set, avoid using delta-encoded compression, and use ordinary
    zlib compression instead.  Useful for comparing file sizes using
    different compression modes.

 app/xcf/xcf.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/app/xcf/xcf.c b/app/xcf/xcf.c
index c9f8998..5e1e365 100644
--- a/app/xcf/xcf.c
+++ b/app/xcf/xcf.c
@@ -347,6 +347,7 @@ xcf_save_stream (Gimp           *gimp,
   const gchar *filename;
   gboolean     success  = FALSE;
   GError      *my_error = NULL;
+  gboolean     zlib_compression;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
@@ -367,14 +368,21 @@ xcf_save_stream (Gimp           *gimp,
   info.progress         = progress;
   info.file             = output_file;
 
-  if (gimp_image_get_xcf_compression (image))
-    info.compression = COMPRESS_ZLIB_DELTA;
+  zlib_compression = gimp_image_get_xcf_compression (image);
+
+  if (zlib_compression)
+    {
+      if (g_getenv ("GIMP_XCF_NO_DELTA_COMPRESSION"))
+        info.compression = COMPRESS_ZLIB;
+      else
+        info.compression = COMPRESS_ZLIB_DELTA;
+    }
   else
-    info.compression = COMPRESS_RLE;
+    {
+      info.compression = COMPRESS_RLE;
+    }
 
-  info.file_version = gimp_image_get_xcf_version (image,
-                                                  info.compression ==
-                                                  COMPRESS_ZLIB_DELTA,
+  info.file_version = gimp_image_get_xcf_version (image, zlib_compression,
                                                   NULL, NULL);
 
   if (info.file_version >= 11)


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