diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-03-25 17:15:06 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-03-25 17:15:38 +0000 |
commit | a1ca4f85637a5b35ad7a7da751077e447cba3ab2 (patch) | |
tree | df7ea29082e67712f0025bb3d069eff76b16b8b6 | |
parent | 9ad2861db413929acbdab8fe02786e635c3199f7 (diff) | |
download | mupdf-a1ca4f85637a5b35ad7a7da751077e447cba3ab2.tar.xz |
Fix PS output banded mode operation.
-rw-r--r-- | source/fitz/output-ps.c | 13 | ||||
-rw-r--r-- | source/tools/mudraw.c | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c index 35c0a333..e80a3f00 100644 --- a/source/fitz/output-ps.c +++ b/source/fitz/output-ps.c @@ -156,10 +156,17 @@ void fz_save_pixmap_as_ps(fz_context *ctx, fz_pixmap *pixmap, char *filename, in void fz_write_ps_band(fz_context *ctx, fz_output *out, fz_ps_output_context *psoc, int w, int h, int n, int band, int bandheight, unsigned char *samples) { int x, y, i, err; - int required_input = w*(n-1)*h; - int required_output = (int)deflateBound(&psoc->stream, required_input); + int required_input; + int required_output; unsigned char *o; + band *= bandheight; + if (band+bandheight >= h) + bandheight = h - band; + + required_input = w*(n-1)*bandheight; + required_output = (int)deflateBound(&psoc->stream, required_input); + if (psoc->input == NULL || psoc->input_size < required_input) { fz_free(ctx, psoc->input); @@ -177,7 +184,7 @@ void fz_write_ps_band(fz_context *ctx, fz_output *out, fz_ps_output_context *pso } o = psoc->input; - for (y = 0; y < h; y++) + for (y = 0; y < bandheight; y++) for (x = 0; x < w; x++) { for (i = n-1; i > 0; i--) diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index aca7a2f4..95b6765c 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -1049,9 +1049,9 @@ int mudraw_main(int argc, char **argv) if (bandheight) { - if (output_format != OUT_PAM && output_format != OUT_PGM && output_format != OUT_PPM && output_format != OUT_PNM && output_format != OUT_PNG && output_format != OUT_PBM && output_format != OUT_PKM && output_format != OUT_PCL) + if (output_format != OUT_PAM && output_format != OUT_PGM && output_format != OUT_PPM && output_format != OUT_PNM && output_format != OUT_PNG && output_format != OUT_PBM && output_format != OUT_PKM && output_format != OUT_PCL && output_format != OUT_PS) { - fprintf(stderr, "Banded operation only possible with PAM, PBM, PGM, PKM, PPM, PNM and PNG outputs\n"); + fprintf(stderr, "Banded operation only possible with PAM, PBM, PGM, PKM, PPM, PNM, PCL, PS and PNG outputs\n"); exit(1); } if (showmd5) |