diff options
-rw-r--r-- | source/fitz/load-jpx.c | 7 | ||||
-rw-r--r-- | source/fitz/load-tiff.c | 4 | ||||
-rw-r--r-- | source/fitz/pixmap.c | 3 |
3 files changed, 1 insertions, 13 deletions
diff --git a/source/fitz/load-jpx.c b/source/fitz/load-jpx.c index 4065b386..2f9be9a3 100644 --- a/source/fitz/load-jpx.c +++ b/source/fitz/load-jpx.c @@ -406,10 +406,7 @@ jpx_read_image(fz_context *ctx, fz_jpxd *state, unsigned char *data, size_t size if (state->pix->alpha && ! (HAS_PALETTE(colorspace) && !state->expand_indexed)) { if (alphas > 0 && prealphas == 0) - { - state->pix = fz_ensure_pixmap_is_additive(ctx, state->pix); fz_premultiply_pixmap(ctx, state->pix); - } } } fz_always(ctx) @@ -877,12 +874,8 @@ jpx_read_image(fz_context *ctx, fz_jpxd *state, unsigned char *data, size_t size if (jpx->color_space == OPJ_CLRSPC_SYCC && n == 3 && a == 0) jpx_ycc_to_rgb(ctx, img, 1, 1); - if (a) - { - img = fz_ensure_pixmap_is_additive(ctx, img); fz_premultiply_pixmap(ctx, img); - } } fz_always(ctx) opj_image_destroy(jpx); diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c index 08ca17a7..881498c0 100644 --- a/source/fitz/load-tiff.c +++ b/source/fitz/load-tiff.c @@ -1320,11 +1320,9 @@ fz_load_tiff_subimage(fz_context *ctx, unsigned char *buf, size_t len, int subim fz_unpack_tile(ctx, image, tiff.samples, tiff.samplesperpixel, tiff.bitspersample, tiff.stride, 0); /* We should only do this on non-pre-multiplied images, but files in the wild are bad */ + /* TODO: check if any samples are non-premul to detect bad files */ if (tiff.extrasamples /* == 2 */) - { - image = fz_ensure_pixmap_is_additive(ctx, image); fz_premultiply_pixmap(ctx, image); - } } fz_always(ctx) { diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c index d89889fd..21e75764 100644 --- a/source/fitz/pixmap.c +++ b/source/fitz/pixmap.c @@ -676,9 +676,6 @@ fz_premultiply_pixmap(fz_context *ctx, fz_pixmap *pix) if (!pix->alpha) return; - if (fz_colorspace_is_subtractive(ctx, pix->colorspace)) - fz_throw(ctx, FZ_ERROR_GENERIC, "cannot pre-multiply subtractive colors"); - for (y = 0; y < pix->h; y++) { for (x = 0; x < pix->w; x++) |