diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-06-28 15:01:39 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-06-28 15:15:42 +0100 |
commit | 5c41dcd3f3458f7e1562a9493b4cba0da83f4188 (patch) | |
tree | 3e94316bb611c43d04926b16e8af76397c2e14d3 /source | |
parent | 12aa6f724a04f1729513690a14d3a0bdc0725732 (diff) | |
download | mupdf-5c41dcd3f3458f7e1562a9493b4cba0da83f4188.tar.xz |
Fix inconsistency in band handling.
In an earlier commit, I changed some of the band writing functions
to take the band starting offset, rather than the band number. This
was done to accomodate the idea of rendering the page in bands of
different heights.
Sadly, it seems I didn't push this all the way through, and had
different band writing functions still taking the band number.
Fix all the band writing functions to be consistent.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/output-pcl.c | 7 | ||||
-rw-r--r-- | source/fitz/output-ps.c | 7 | ||||
-rw-r--r-- | source/tools/mudraw.c | 10 |
3 files changed, 11 insertions, 13 deletions
diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c index 6d0a24a6..c0858299 100644 --- a/source/fitz/output-pcl.c +++ b/source/fitz/output-pcl.c @@ -777,7 +777,7 @@ fz_color_pcl_output_context *fz_write_color_pcl_header(fz_context *ctx, fz_outpu return pcoc; } -void fz_write_color_pcl_band(fz_context *ctx, fz_output *out, fz_color_pcl_output_context *pcoc, int w, int h, int n, int stride, int band, int bandheight, unsigned char *sp) +void fz_write_color_pcl_band(fz_context *ctx, fz_output *out, fz_color_pcl_output_context *pcoc, int w, int h, int n, int stride, int band_start, int bandheight, unsigned char *sp) { int y, ss, ds, seed_valid, fill; unsigned char *prev; @@ -796,9 +796,8 @@ void fz_write_color_pcl_band(fz_context *ctx, fz_output *out, fz_color_pcl_outpu comp = pcoc->compbuf; seed_valid = pcoc->seed_valid; - band *= bandheight; - if (band+bandheight >= h) - bandheight = h - band; + if (band_start+bandheight >= h) + bandheight = h - band_start; y = 0; while (y < bandheight) diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c index 1c4f5103..d183adf6 100644 --- a/source/fitz/output-ps.c +++ b/source/fitz/output-ps.c @@ -153,16 +153,15 @@ void fz_save_pixmap_as_ps(fz_context *ctx, fz_pixmap *pixmap, char *filename, in fz_rethrow(ctx); } -void fz_write_ps_band(fz_context *ctx, fz_output *out, fz_ps_output_context *psoc, int w, int h, int n, int stride, int band, int bandheight, unsigned char *samples) +void fz_write_ps_band(fz_context *ctx, fz_output *out, fz_ps_output_context *psoc, int w, int h, int n, int stride, int band_start, int bandheight, unsigned char *samples) { int x, y, i, err; int required_input; int required_output; unsigned char *o; - band *= bandheight; - if (band+bandheight >= h) - bandheight = h - band; + if (band_start+bandheight >= h) + bandheight = h - band_start; required_input = w*(n-1)*bandheight; required_output = (int)deflateBound(&psoc->stream, required_input); diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 7e4b40fb..4912bd52 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -908,11 +908,11 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in if (output) { if (output_format == OUT_PGM || output_format == OUT_PPM || output_format == OUT_PNM) - fz_write_pnm_band(ctx, out, pix->w, totalheight, pix->n, pix->alpha, pix->stride, band, drawheight, pix->samples); + fz_write_pnm_band(ctx, out, pix->w, totalheight, pix->n, pix->alpha, pix->stride, band * bandheight, drawheight, pix->samples); else if (output_format == OUT_PAM) - fz_write_pam_band(ctx, out, pix->w, totalheight, pix->n, pix->alpha, pix->stride, band, drawheight, pix->samples); + fz_write_pam_band(ctx, out, pix->w, totalheight, pix->n, pix->alpha, pix->stride, band * bandheight, drawheight, pix->samples); else if (output_format == OUT_PNG) - fz_write_png_band(ctx, out, poc, pix->stride, band, drawheight, pix->samples); + fz_write_png_band(ctx, out, poc, pix->stride, band * bandheight, drawheight, pix->samples); else if (output_format == OUT_PWG) fz_write_pixmap_as_pwg(ctx, out, pix, NULL); else if (output_format == OUT_PCL) @@ -924,10 +924,10 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in bit = NULL; } else - fz_write_color_pcl_band(ctx, out, pccoc, pix->w, totalheight, pix->n, pix->stride, band, drawheight, pix->samples); + fz_write_color_pcl_band(ctx, out, pccoc, pix->w, totalheight, pix->n, pix->stride, band * bandheight, drawheight, pix->samples); } else if (output_format == OUT_PS) - fz_write_ps_band(ctx, out, psoc, pix->w, totalheight, pix->n, pix->stride, band, drawheight, pix->samples); + fz_write_ps_band(ctx, out, psoc, pix->w, totalheight, pix->n, pix->stride, band * bandheight, drawheight, pix->samples); else if (output_format == OUT_PBM) { fz_write_pbm_band(ctx, out, bit); |