diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-10-29 16:52:46 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-12-14 20:39:20 +0100 |
commit | 508db7953f094f58e9a99172c7803c3e67afe308 (patch) | |
tree | 927a59935cf00260cc71da7f21fde93bd3f97898 /source | |
parent | 5e6a7114f16b91198538f3ae488966d9622626ee (diff) | |
download | mupdf-508db7953f094f58e9a99172c7803c3e67afe308.tar.xz |
Have callers of fz_new_image_from_pixmap() drop supplied mask.
This makes handling of the mask identical to that of the pixmap
argument.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/image.c | 31 | ||||
-rw-r--r-- | source/pdf/pdf-image.c | 3 |
2 files changed, 13 insertions, 21 deletions
diff --git a/source/fitz/image.c b/source/fitz/image.c index f71b5d23..2d18a87b 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -743,26 +743,17 @@ fz_new_image_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, fz_image *mask) { fz_pixmap_image *image; - assert(mask == NULL || mask->mask == NULL); + image = (fz_pixmap_image *) + fz_new_image(ctx, pixmap->w, pixmap->h, 8, pixmap->colorspace, + pixmap->xres, pixmap->yres, 0, 0, + NULL, NULL, mask, + sizeof(fz_pixmap_image), + pixmap_image_get_pixmap, + pixmap_image_get_size, + drop_pixmap_image); + image->tile = fz_keep_pixmap(ctx, pixmap); + image->super.decoded = 1; - fz_try(ctx) - { - image = (fz_pixmap_image *) - fz_new_image(ctx, pixmap->w, pixmap->h, 8, pixmap->colorspace, - pixmap->xres, pixmap->yres, 0, 0, - NULL, NULL, mask, - sizeof(fz_pixmap_image), - pixmap_image_get_pixmap, - pixmap_image_get_size, - drop_pixmap_image); - image->tile = fz_keep_pixmap(ctx, pixmap); - image->super.decoded = 1; - } - fz_catch(ctx) - { - fz_drop_image(ctx, mask); - fz_rethrow(ctx); - } return &image->super; } @@ -817,7 +808,7 @@ fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace, } if (i != image->n) image->use_decode = 1; - image->mask = mask; + image->mask = fz_keep_image(ctx, mask); return image; } diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c index 0d5e67ef..d44671b2 100644 --- a/source/pdf/pdf-image.c +++ b/source/pdf/pdf-image.c @@ -260,9 +260,10 @@ pdf_load_jpx(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int forcemask) } fz_always(ctx) { + fz_drop_image(ctx, mask); + fz_drop_pixmap(ctx, pix); fz_drop_colorspace(ctx, colorspace); fz_drop_buffer(ctx, buf); - fz_drop_pixmap(ctx, pix); } fz_catch(ctx) { |