diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-05-23 17:45:21 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-05-24 12:48:35 +0100 |
commit | d0b78f4166a1503ce522944002b3aab035724cd9 (patch) | |
tree | b8c680dc401db56a28be1110759219c7c175dd8d /source/fitz/output-ps.c | |
parent | 841952db71d6541a2e98fd4d1d49dede284b2cf8 (diff) | |
download | mupdf-d0b78f4166a1503ce522944002b3aab035724cd9.tar.xz |
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.
Diffstat (limited to 'source/fitz/output-ps.c')
-rw-r--r-- | source/fitz/output-ps.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; |