summaryrefslogtreecommitdiff
path: root/source/fitz/load-tiff.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-09-17 19:19:51 +0800
committerSebastian Rasmussen <sebras@gmail.com>2016-09-18 12:42:39 +0800
commitc7a7471c35c803c130d2bfa7fc1a57967364c91e (patch)
tree3926780baee684cd7f4c50e2e8713e5c39e35dc6 /source/fitz/load-tiff.c
parenta7376dbdcdca7862d59951595b6faad31e200465 (diff)
downloadmupdf-c7a7471c35c803c130d2bfa7fc1a57967364c91e.tar.xz
tiff: Do not assume that images always have alpha component.
Diffstat (limited to 'source/fitz/load-tiff.c')
-rw-r--r--source/fitz/load-tiff.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index 8f4c2629..ace925d8 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -871,6 +871,7 @@ fz_load_tiff_subimage(fz_context *ctx, unsigned char *buf, size_t len, int subim
{
fz_pixmap *image;
struct tiff tiff = { 0 };
+ int alpha;
fz_try(ctx)
{
@@ -891,7 +892,8 @@ fz_load_tiff_subimage(fz_context *ctx, unsigned char *buf, size_t len, int subim
fz_swap_tiff_byte_order(tiff.samples, tiff.imagewidth * tiff.imagelength * tiff.samplesperpixel);
/* Expand into fz_pixmap struct */
- image = fz_new_pixmap(ctx, tiff.colorspace, tiff.imagewidth, tiff.imagelength, 1);
+ alpha = tiff.extrasamples != 0;
+ image = fz_new_pixmap(ctx, tiff.colorspace, tiff.imagewidth, tiff.imagelength, alpha);
image->xres = tiff.xresolution;
image->yres = tiff.yresolution;