diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-04-28 19:42:45 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-04-28 19:45:56 +0100 |
commit | 858d56ff790966ea614a0217510cdf36d0496488 (patch) | |
tree | 0eacaa7c68b8b93b2f50d23a92a5114cd69f4e00 | |
parent | ad13312fc42a236750fbea697a07e4109fae8513 (diff) | |
download | mupdf-858d56ff790966ea614a0217510cdf36d0496488.tar.xz |
Fix JPX breakage caused during refactor.
I was using fz_compressed_image when I should have been using
fz_pixmap_image.
-rw-r--r-- | include/mupdf/fitz/image.h | 4 | ||||
-rw-r--r-- | source/fitz/image.c | 17 | ||||
-rw-r--r-- | source/pdf/pdf-image.c | 6 |
3 files changed, 22 insertions, 5 deletions
diff --git a/include/mupdf/fitz/image.h b/include/mupdf/fitz/image.h index 41c4b80c..96434d35 100644 --- a/include/mupdf/fitz/image.h +++ b/include/mupdf/fitz/image.h @@ -19,6 +19,7 @@ */ typedef struct fz_image_s fz_image; typedef struct fz_compressed_image_s fz_compressed_image; +typedef struct fz_pixmap_image_s fz_pixmap_image; /* fz_get_pixmap_from_image: Called to get a handle to a pixmap from an image. @@ -121,4 +122,7 @@ void fz_set_compressed_image_tile(fz_context *ctx, fz_compressed_image *cimg, fz fz_compressed_buffer *fz_compressed_image_buffer(fz_context *ctx, fz_image *image); void fz_set_compressed_image_buffer(fz_context *ctx, fz_compressed_image *cimg, fz_compressed_buffer *buf); +fz_pixmap *fz_pixmap_image_tile(fz_context *ctx, fz_pixmap_image *cimg); +void fz_set_pixmap_image_tile(fz_context *ctx, fz_pixmap_image *cimg, fz_pixmap *pix); + #endif diff --git a/source/fitz/image.c b/source/fitz/image.c index 538f52ec..cf61fd28 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -10,11 +10,11 @@ struct fz_compressed_image_s fz_compressed_buffer *buffer; }; -typedef struct fz_pixmap_image_s +struct fz_pixmap_image_s { fz_image super; fz_pixmap *tile; -} fz_pixmap_image; +}; fz_image * fz_keep_image(fz_context *ctx, fz_image *image) @@ -780,6 +780,19 @@ void fz_set_compressed_image_tile(fz_context *ctx, fz_compressed_image *image, f ((fz_compressed_image *)image)->tile = pix; } +fz_pixmap *fz_pixmap_image_tile(fz_context *ctx, fz_pixmap_image *image) +{ + if (image == NULL || image->super.get_pixmap != pixmap_image_get_pixmap) + return NULL; + return ((fz_pixmap_image *)image)->tile; +} + +void fz_set_pixmap_image_tile(fz_context *ctx, fz_pixmap_image *image, fz_pixmap *pix) +{ + assert(image != NULL && image->super.get_pixmap == pixmap_image_get_pixmap); + ((fz_pixmap_image *)image)->tile = pix; +} + fz_image * fz_new_image_from_data(fz_context *ctx, unsigned char *data, int len) { diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c index 4fec9faa..51bb4583 100644 --- a/source/pdf/pdf-image.c +++ b/source/pdf/pdf-image.c @@ -37,9 +37,9 @@ pdf_load_image_imp(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *di if (forcemask) { - fz_compressed_image *cimg = (fz_compressed_image *)image; + fz_pixmap_image *cimg = (fz_pixmap_image *)image; fz_pixmap *mask_pixmap; - fz_pixmap *tile = fz_compressed_image_tile(ctx, cimg); + fz_pixmap *tile = fz_pixmap_image_tile(ctx, cimg); if (image->n != 2) { fz_pixmap *gray; @@ -52,7 +52,7 @@ pdf_load_image_imp(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *di } mask_pixmap = fz_alpha_from_gray(ctx, tile, 1); fz_drop_pixmap(ctx, tile); - fz_set_compressed_image_tile(ctx, cimg, mask_pixmap); + fz_set_pixmap_image_tile(ctx, cimg, mask_pixmap); } break; /* Out of fz_try */ } |