diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-05-24 13:46:28 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-05-26 10:36:35 +0100 |
commit | ee972fbfa1093fe2e8641dc450e1c20347df2b04 (patch) | |
tree | 8ff2a934f13e3804a28e21ce5bd0eabfde5b549d /source/fitz/image.c | |
parent | dff58514f30b10850bab0205580af98ec3217d64 (diff) | |
download | mupdf-ee972fbfa1093fe2e8641dc450e1c20347df2b04.tar.xz |
Avoid unnecessary alphas when decompressing images from streams.
Diffstat (limited to 'source/fitz/image.c')
-rw-r--r-- | source/fitz/image.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/fitz/image.c b/source/fitz/image.c index bd6e0b62..c49580bf 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -198,7 +198,10 @@ fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_compressed_image fz_try(ctx) { - tile = fz_new_pixmap(ctx, image->colorspace, w, h, 1); + int alpha = (image->colorspace == NULL); + if (image->use_colorkey) + alpha = 1; + tile = fz_new_pixmap(ctx, image->colorspace, w, h, alpha); tile->interpolate = image->interpolate; stride = (w * image->n * image->bpc + 7) / 8; @@ -276,7 +279,7 @@ fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_compressed_image { fz_pixmap *conv; fz_decode_indexed_tile(ctx, tile, image->decode, (1 << image->bpc) - 1); - conv = fz_expand_indexed_pixmap(ctx, tile); + conv = fz_expand_indexed_pixmap(ctx, tile, alpha); fz_drop_pixmap(ctx, tile); tile = conv; } |