diff options
author | Robin Watts <robin.watts@artifex.com> | 2017-01-09 11:09:48 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2017-01-09 11:11:16 +0000 |
commit | e9667e7f8ab7c154d8932916a22c33cf2bad0445 (patch) | |
tree | 48ef0ef750fa8845398005a3d57ac1b0fbbdd7c3 /source | |
parent | cc198a1744e4acadde08972e9b66e24a9016727d (diff) | |
download | mupdf-e9667e7f8ab7c154d8932916a22c33cf2bad0445.tar.xz |
Bug 697466: Fix banded PKM/PBM output.
When I regularised the band writing interface, I broke PKM and PBM
in the banded case. Fixed here.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/bitmap.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/fitz/bitmap.c b/source/fitz/bitmap.c index 046e7aa0..7003a894 100644 --- a/source/fitz/bitmap.c +++ b/source/fitz/bitmap.c @@ -353,12 +353,17 @@ pbm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta int h = writer->h; int n = writer->n; int bytestride; + int end = band_start + band_height; if (n != 1) fz_throw(ctx, FZ_ERROR_GENERIC, "too many color components in bitmap"); + if (end > h) + end = h; + end -= band_start; + bytestride = (w + 7) >> 3; - while (h--) + while (end--) { fz_write(ctx, out, p, bytestride); p += stride; @@ -373,12 +378,17 @@ pkm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta int h = writer->h; int n = writer->n; int bytestride; + int end = band_start + band_height; if (n != 4) fz_throw(ctx, FZ_ERROR_GENERIC, "wrong number of color components in bitmap"); + if (end > h) + end = h; + end -= band_start; + bytestride = stride - (w>>1); - while (h--) + while (end--) { int ww = w-1; while (ww > 0) |