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/pdf/pdf-resources.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source/pdf/pdf-resources.c') diff --git a/source/pdf/pdf-resources.c b/source/pdf/pdf-resources.c index 212c57df..b66c0a23 100644 --- a/source/pdf/pdf-resources.c +++ b/source/pdf/pdf-resources.c @@ -27,10 +27,18 @@ res_image_get_md5(fz_context *ctx, fz_image *image, unsigned char *digest) { fz_pixmap *pixmap; fz_md5 state; + int h; + unsigned char *d; pixmap = fz_get_pixmap_from_image(ctx, image, NULL, NULL, 0, 0); fz_md5_init(&state); - fz_md5_update(&state, pixmap->samples, pixmap->w * pixmap->h * pixmap->n); + d = pixmap->samples; + h = pixmap->h; + while (h--) + { + fz_md5_update(&state, d, pixmap->w * pixmap->n); + d += pixmap->stride; + } fz_md5_final(&state, digest); fz_drop_pixmap(ctx, pixmap); } -- cgit v1.2.3