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



commit 183019900e3274d9ac2ff221f93515ec309bb478
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 0145548..7c7c0ac 100644
--- a/app/xcf/xcf.c
+++ b/app/xcf/xcf.c
@@ -345,6 +345,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);
@@ -365,14 +366,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]