From ee26ab550a27bd8764084f391f16fb5dbda3d325 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 10 Jul 2015 18:34:12 +0100 Subject: Enable fz_images to have NULL buffers, and still be decoded. Important for gproof files. --- source/fitz/image.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/fitz/image.c b/source/fitz/image.c index 3c7e7c0e..a63aaf9a 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -302,14 +302,15 @@ fz_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h) fz_image_key key; fz_image_key *keyp; - /* Check for 'simple' images which are just pixmaps */ - if (image->buffer == NULL) - { - tile = image->tile; - if (!tile) - return NULL; - return fz_keep_pixmap(ctx, tile); /* That's all we can give you! */ - } + /* 'Simple' images created direct from pixmaps will have no buffer + * of compressed data. We cannot do any better than just returning + * a pointer to the original 'tile'. + * + * Note, that we can get image->tile != NULL for jpeg 2000 images + * with masks applied, so we need both parts of the following test. + */ + if (image->buffer == NULL && image->tile != NULL) + return fz_keep_pixmap(ctx, image->tile); /* That's all we can give you! */ /* Ensure our expectations for tile size are reasonable */ if (w < 0 || w > image->w) -- cgit v1.2.3