From d0b78f4166a1503ce522944002b3aab035724cd9 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 23 May 2016 17:45:21 +0100 Subject: fz_pixmap revamp: add stride and make alpha optional fz_pixmaps now have an explicit stride value. By default no change from before, but code all copes with extra gaps at the end of the line. The alpha data in fz_pixmaps is no longer compulsory. mudraw: use rgb not rgba (ppmraw), cmyk not cmyka (pkmraw). Update halftone code to not expect alpha plane. Update PNG writing to cope with alpha less input. Also hide repeated params within the png output context. ARM code needs updating. --- source/fitz/output-ps.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/fitz/output-ps.c') diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c index e80a3f00..1c4f5103 100644 --- a/source/fitz/output-ps.c +++ b/source/fitz/output-ps.c @@ -128,7 +128,7 @@ void fz_write_pixmap_as_ps(fz_context *ctx, fz_output *out, const fz_pixmap *pix fz_try(ctx) { - fz_write_ps_band(ctx, out, psoc, pixmap->w, pixmap->h, pixmap->n, 0, 0, pixmap->samples); + fz_write_ps_band(ctx, out, psoc, pixmap->w, pixmap->h, pixmap->n, pixmap->stride, 0, 0, pixmap->samples); } fz_always(ctx) { @@ -153,7 +153,7 @@ 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 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, int bandheight, unsigned char *samples) { int x, y, i, err; int required_input; @@ -185,12 +185,15 @@ void fz_write_ps_band(fz_context *ctx, fz_output *out, fz_ps_output_context *pso o = psoc->input; for (y = 0; y < bandheight; y++) + { for (x = 0; x < w; x++) { for (i = n-1; i > 0; i--) *o++ = *samples++; samples++; } + samples += stride - w*n; + } psoc->stream.next_in = (Bytef*)psoc->input; psoc->stream.avail_in = required_input; -- cgit v1.2.3