[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1796-gec065fd

[email protected] (Robin Watts) Fri, 1 Nov 2019 15:11:05 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  ec065fd285f8064ac34cc160106dd730569ebc75 (commit)
       via  e4dce29961108c6fef5c02bf4d5e527b265bf8d8 (commit)
       via  9076e48cf91ba6bf4e939b0562c53e6cbb62282e (commit)
      from  1126deff06d81d4fa1975ea0ed3a3b64e9cf0661 (commit)

----------------------------------------------------------------------
commit ec065fd285f8064ac34cc160106dd730569ebc75
Author: Robin Watts <[email protected]>
Date:   Fri Nov 1 14:55:16 2019 +0000

    Clear eol padding bits in "atx" devices.
    
    This upsets the blank line detection and therefore can randomly
    change the output.

diff --git a/devices/gdevatx.c b/devices/gdevatx.c
index b522331..fd68386 100644
--- a/devices/gdevatx.c
+++ b/devices/gdevatx.c
@@ -167,6 +167,7 @@ atx_print_page(gx_device_printer *pdev, gp_file *f, int max_width_bytes)
         (int)ceil((height / pdev->HWResolution[1] + top_bottom_skip) * 100);
     gs_memory_t *mem = pdev->memory;
     int raster = gx_device_raster((gx_device *)pdev, true);
+    int width = pdev->width;
     byte *buf;
     /*
      * ATX_COMPRESSED_DATA only takes a 1-byte (word) count.
@@ -176,6 +177,8 @@ atx_print_page(gx_device_printer *pdev, gp_file *f, int max_width_bytes)
     byte *compressed;
     int blank_lines, lnum;
     int code = 0;
+    byte mask;
+    int endidx = width>>3;
 
     /* Enforce a minimum 3" page length. */
     if (page_length_100ths < 300)
@@ -187,6 +190,12 @@ atx_print_page(gx_device_printer *pdev, gp_file *f, int max_width_bytes)
         code = gs_note_error(gs_error_VMerror);
         goto done;
     }
+    memset(buf, 0, raster);
+    if (width & 7)
+        mask = ~(255>>(width & 7));
+    else
+        mask = 255, endidx--;
+
     fput_atx_command(f, ATX_SET_PAGE_LENGTH, page_length_100ths);
     for (blank_lines = 0, lnum = 0; lnum < height; ++lnum) {
         byte *row;
@@ -194,6 +203,8 @@ atx_print_page(gx_device_printer *pdev, gp_file *f, int max_width_bytes)
         int count;
 
         gdev_prn_get_bits(pdev, lnum, buf, &row);
+        /* Clear any trailing padding bits */
+        row[endidx] &= mask;
         /* Find the end of the non-blank data. */
         for (end = row + raster; end > row && end[-1] == 0 && end[-2] == 0; )
             end -= 2;

----------------------------------------------------------------------
commit e4dce29961108c6fef5c02bf4d5e527b265bf8d8
Author: Robin Watts <[email protected]>
Date:   Fri Nov 1 14:26:52 2019 +0000

    Mask eol padding bits for pngmono device in CLUSTER builds.

diff --git a/devices/gdevpng.c b/devices/gdevpng.c
index 1096251..73bc5bf 100644
--- a/devices/gdevpng.c
+++ b/devices/gdevpng.c
@@ -557,7 +557,7 @@ do_png_print_page(gx_device_png * pdev, gp_file * file, bool monod)
         case 1:
             bit_depth = 1;
             color_type = PNG_COLOR_TYPE_GRAY;
-            /* invert monocrome pixels */
+            /* invert monochrome pixels */
             if (!monod) {
                 invert = true;
             }
@@ -700,9 +700,21 @@ do_png_print_page(gx_device_png * pdev, gp_file * file, bool monod)
                               depth/dst_bpc, factor, mfs, NULL, 0);
     if (code >= 0)
     {
+#ifdef CLUSTER
+        int bitlen = width*dst_bpc;
+        int end = bitlen>>3;
+        int mask = 255>>(bitlen&7);
+        if (bitlen & 7)
+            mask = ~mask;
+        else
+            end--;
+#endif
         /* Write the contents of the image. */
         for (y = 0; y < height; y++) {
             gx_downscaler_getbits(&ds, row, y);
+#ifdef CLUSTER
+            row[end] &= mask;
+#endif
             png_write_rows(png_ptr, &row, 1);
         }
         gx_downscaler_fin(&ds);

----------------------------------------------------------------------
commit 9076e48cf91ba6bf4e939b0562c53e6cbb62282e
Author: Robin Watts <[email protected]>
Date:   Fri Nov 1 14:24:08 2019 +0000

    Fix previous planm eol masking fix.
    
    The previous attempt to fix the masking of eol padding bits
    for planm would have failed in the width == multiple of 8 case.
    Also make it dependent on CLUSTER here.

diff --git a/devices/gdevplan.c b/devices/gdevplan.c
index 84640a7..313d08f 100644
--- a/devices/gdevplan.c
+++ b/devices/gdevplan.c
@@ -248,7 +248,16 @@ static void dump_row_pnmc(int w, byte **data, gp_file *dump_file)
 static void dump_row_pbm(int w, byte **data, gp_file *dump_file)
 {
     byte *r = data[0];
-    int mask = ~(255>>(w&7));
+#ifdef CLUSTER
+    int end = w>>3;
+    byte mask = 255>>(w&7);
+    if (w & 7)
+        mask = ~mask;
+    else
+        end--;
+#else
+    byte mask = 255;
+#endif
 
     if (dump_file == NULL)
         return;


Summary of changes:
 devices/gdevatx.c  | 11 +++++++++++
 devices/gdevplan.c | 11 ++++++++++-
 devices/gdevpng.c  | 14 +++++++++++++-
 3 files changed, 34 insertions(+), 2 deletions(-)