From ee972fbfa1093fe2e8641dc450e1c20347df2b04 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 24 May 2016 13:46:28 +0100 Subject: Avoid unnecessary alphas when decompressing images from streams. --- source/fitz/draw-unpack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/fitz/draw-unpack.c') diff --git a/source/fitz/draw-unpack.c b/source/fitz/draw-unpack.c index ccb3c62f..0211b7e4 100644 --- a/source/fitz/draw-unpack.c +++ b/source/fitz/draw-unpack.c @@ -179,7 +179,8 @@ fz_decode_indexed_tile(fz_context *ctx, fz_pixmap *pix, const float *decode, int unsigned char *p = pix->samples; int stride = pix->stride - pix->w * pix->n; int len; - int n = pix->n - 1; + int pn = pix->n; + int n = pn - pix->alpha; int needed; int k; int h; @@ -208,7 +209,7 @@ fz_decode_indexed_tile(fz_context *ctx, fz_pixmap *pix, const float *decode, int int value = (add[k] + (((p[k] << 8) * mul[k]) >> 8)) >> 8; p[k] = fz_clampi(value, 0, 255); } - p += n + 1; + p += pn; } p += stride; } -- cgit v1.2.3