diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2019-11-01 14:55:16 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2019-11-01 14:56:18 +0000 |
commit | ec065fd285f8064ac34cc160106dd730569ebc75 (patch) | |
tree | cd3c61d7e9bb01034825e6985fb860b74dd9e623 /devices/gdevatx.c | |
parent | e4dce29961108c6fef5c02bf4d5e527b265bf8d8 (diff) | |
download | ghostpdl-ec065fd285f8064ac34cc160106dd730569ebc75.tar.gz |
Clear eol padding bits in "atx" devices.
This upsets the blank line detection and therefore can randomly
change the output.
Diffstat (limited to 'devices/gdevatx.c')
-rw-r--r-- | devices/gdevatx.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/devices/gdevatx.c b/devices/gdevatx.c index b5223316f..fd6838682 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; |