summaryrefslogtreecommitdiff
path: root/source/fitz/draw-unpack.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-05-24 13:46:28 +0100
committerRobin Watts <robin.watts@artifex.com>2016-05-26 10:36:35 +0100
commitee972fbfa1093fe2e8641dc450e1c20347df2b04 (patch)
tree8ff2a934f13e3804a28e21ce5bd0eabfde5b549d /source/fitz/draw-unpack.c
parentdff58514f30b10850bab0205580af98ec3217d64 (diff)
downloadmupdf-ee972fbfa1093fe2e8641dc450e1c20347df2b04.tar.xz
Avoid unnecessary alphas when decompressing images from streams.
Diffstat (limited to 'source/fitz/draw-unpack.c')
-rw-r--r--source/fitz/draw-unpack.c5
1 files changed, 3 insertions, 2 deletions
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;
}