changeset 1783:1ce808599129

Add DM_RLE_ZERO_COUNT_MAX flag for RLE decoder which makes it interpret run lengths of 0 as maximum value of the type, e.g. 256 or 65536 (latter is probably useless.)
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 13 Jun 2018 01:34:46 +0300
parents 22b6fa1a2ee4
children a29d38862037
files tools/lib64gfx.c tools/lib64gfx.h
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64gfx.c	Wed Jun 13 01:23:45 2018 +0300
+++ b/tools/lib64gfx.c	Wed Jun 13 01:34:46 2018 +0300
@@ -474,6 +474,9 @@
                         count = tmp2;
                         break;
                 }
+
+                if (count == 0 && (cfg->flags & DM_RLE_ZERO_COUNT_MAX))
+                    count = 256;
             }
             else
             if ((cfg->flags & DM_RLE_WORD_RUNS) && data == cfg->rleMarkerW)
@@ -499,6 +502,9 @@
                         count = (tmp3 << 8) | tmp2;
                         break;
                 }
+
+                if (count == 0 && (cfg->flags & DM_RLE_ZERO_COUNT_MAX))
+                    count = 65536;
             }
         }
         else
--- a/tools/lib64gfx.h	Wed Jun 13 01:23:45 2018 +0300
+++ b/tools/lib64gfx.h	Wed Jun 13 01:34:46 2018 +0300
@@ -242,6 +242,7 @@
 
     DM_RLE_BACKWARDS_INPUT  = 0x0100,
     DM_RLE_BACKWARDS_OUTPUT = 0x0200,
+    DM_RLE_ZERO_COUNT_MAX   = 0x0400,
 
     DM_OUT_CROP_NONE        = 0x0000,
     DM_OUT_CROP_START       = 0x1000,