summaryrefslogtreecommitdiff
path: root/source/fitz/load-jxr.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-12-21 16:19:28 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-12-27 15:06:51 +0100
commit9423400441f32a4c28651ee255cb95cecf49a57a (patch)
tree1cea74f63248ca990e92ca73ef52a87d04aed769 /source/fitz/load-jxr.c
parentbc0b5d4b39e3050c36162d719666053e520161c9 (diff)
downloadmupdf-9423400441f32a4c28651ee255cb95cecf49a57a.tar.xz
Common code to ensure we only premultiply pixmaps with additive colors.
Diffstat (limited to 'source/fitz/load-jxr.c')
-rw-r--r--source/fitz/load-jxr.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/source/fitz/load-jxr.c b/source/fitz/load-jxr.c
index 8bff2833..4ec857dc 100644
--- a/source/fitz/load-jxr.c
+++ b/source/fitz/load-jxr.c
@@ -394,7 +394,9 @@ fz_pixmap *
fz_load_jxr(fz_context *ctx, unsigned char *data, size_t size)
{
struct info info = { 0 };
- fz_pixmap *image;
+ fz_pixmap *image = NULL;
+
+ fz_var(image);
jxr_read_image(ctx, data, size, &info, 0);
@@ -405,18 +407,10 @@ fz_load_jxr(fz_context *ctx, unsigned char *data, size_t size)
fz_try(ctx)
{
-
fz_unpack_tile(ctx, image, info.samples, fz_colorspace_n(ctx, info.cspace) + 1, 8, info.stride, 0);
-
if (info.has_alpha && !info.has_premul)
{
- /* CMYK is a subtractive colorspace, we want additive for premul alpha */
- if (info.comps >= 4)
- {
- fz_pixmap *rgb = fz_convert_pixmap(ctx, image, fz_device_rgb(ctx), 1);
- fz_drop_pixmap(ctx, image);
- image = rgb;
- }
+ image = fz_ensure_pixmap_is_additive(ctx, image);
fz_premultiply_pixmap(ctx, image);
}
}