summaryrefslogtreecommitdiff
path: root/source/fitz/output-pcl.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-05-23 17:45:21 +0100
committerRobin Watts <robin.watts@artifex.com>2016-05-24 12:48:35 +0100
commitd0b78f4166a1503ce522944002b3aab035724cd9 (patch)
treeb8c680dc401db56a28be1110759219c7c175dd8d /source/fitz/output-pcl.c
parent841952db71d6541a2e98fd4d1d49dede284b2cf8 (diff)
downloadmupdf-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-pcl.c')
-rw-r--r--source/fitz/output-pcl.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c
index e37cce85..6d0a24a6 100644
--- a/source/fitz/output-pcl.c
+++ b/source/fitz/output-pcl.c
@@ -687,7 +687,7 @@ fz_write_pixmap_as_pcl(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap,
pcoc = fz_write_color_pcl_header(ctx, out, pixmap->w, pixmap->h, pixmap->n, pixmap->xres, pixmap->yres, 0, pcl);
fz_try(ctx)
- fz_write_color_pcl_band(ctx, out, pcoc, pixmap->w, pixmap->h, pixmap->n, 0, 0, pixmap->samples);
+ fz_write_color_pcl_band(ctx, out, pcoc, pixmap->w, pixmap->h, pixmap->n, pixmap->stride, 0, 0, pixmap->samples);
fz_always(ctx)
fz_write_color_pcl_trailer(ctx, out, pcoc);
fz_catch(ctx)
@@ -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 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, int bandheight, unsigned char *sp)
{
int y, ss, ds, seed_valid, fill;
unsigned char *prev;
@@ -839,14 +839,14 @@ void fz_write_color_pcl_band(fz_context *ctx, fz_output *out, fz_color_pcl_outpu
if (seed_valid && fill + 5 <= 32767 && memcmp(curr, prev, ds) == 0)
{
int count = 1;
- sp += ss;
+ sp += stride;
y++;
while (count < 32767 && y < h)
{
- if (memcmp(sp-ss, sp, ss) != 0)
+ if (memcmp(sp-stride, sp, ss) != 0)
break;
count++;
- sp += ss;
+ sp += stride;
y++;
}
comp[fill++] = 5; /* Duplicate row */
@@ -900,7 +900,7 @@ void fz_write_color_pcl_band(fz_context *ctx, fz_output *out, fz_color_pcl_outpu
/* curr becomes prev */
tmp = prev; prev = curr; curr = tmp;
- sp += ss;
+ sp += stride;
y++;
}
}