summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2015-07-10 18:34:12 +0100
committerRobin Watts <robin.watts@artifex.com>2015-07-20 17:18:56 +0100
commitee26ab550a27bd8764084f391f16fb5dbda3d325 (patch)
tree0e64b0fa54b7d63a378ad694e0f0e9ef3a2924db /source
parent8bece7529ad8752f58d22e7cc3d5aaf7e4741595 (diff)
downloadmupdf-ee26ab550a27bd8764084f391f16fb5dbda3d325.tar.xz
Enable fz_images to have NULL buffers, and still be decoded.
Important for gproof files.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/image.c17
1 files 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)