[gimp/wip/xcf-delta-encoding] app: add GIMP_TESTING_NO_DELTA_COMPRESSION environment flag



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

    app: add GIMP_TESTING_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 0c30267..ae03322 100644
--- a/app/xcf/xcf.c
+++ b/app/xcf/xcf.c
@@ -344,6 +344,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);
@@ -364,14 +365,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_TESTING_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]