summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-resources.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/pdf/pdf-resources.c')
-rw-r--r--source/pdf/pdf-resources.c10
1 files changed, 9 insertions, 1 deletions
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);
}