diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2017-06-23 12:23:36 -0700 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2017-07-17 19:32:06 +0100 |
commit | 63713f22ae830142dfe0d3896948ec53c4705ace (patch) | |
tree | fe8334e262f4507dc2cd2a3ee6d6239bb2c44b40 /source/fitz/draw-device.c | |
parent | 28bfd69eb4101a2197920da6cbc21f491d8cb288 (diff) | |
download | mupdf-63713f22ae830142dfe0d3896948ec53c4705ace.tar.xz |
Add colorspace handling to transparency groups
Also force softmasks to be isolated groups.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r-- | source/fitz/draw-device.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 54ed3f05..66b198fc 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -1854,7 +1854,7 @@ fz_draw_end_mask(fz_context *ctx, fz_device *devp) } static void -fz_draw_begin_group(fz_context *ctx, fz_device *devp, const fz_rect *rect, int isolated, int knockout, int blendmode, float alpha) +fz_draw_begin_group(fz_context *ctx, fz_device *devp, const fz_rect *rect, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) { fz_draw_device *dev = (fz_draw_device*)devp; fz_irect bbox; @@ -1863,6 +1863,9 @@ fz_draw_begin_group(fz_context *ctx, fz_device *devp, const fz_rect *rect, int i fz_colorspace *model = state->dest->colorspace; fz_rect trect = *rect; + if (cs != NULL) + model = fz_default_colorspace(ctx, dev->default_cs, cs); + if (state->blendmode & FZ_BLEND_KNOCKOUT) fz_knockout_begin(ctx, dev); @@ -1952,6 +1955,13 @@ fz_draw_end_group(fz_context *ctx, fz_device *devp) if (state[1].blendmode & FZ_BLEND_KNOCKOUT) printf(" (knockout)"); #endif + if (state[0].dest->colorspace != state[1].dest->colorspace) + { + fz_pixmap *converted = fz_convert_pixmap(ctx, state[1].dest, state[0].dest->colorspace, NULL, dev->default_cs, fz_default_color_params(ctx), 1); + fz_drop_pixmap(ctx, state[1].dest); + state[1].dest = converted; + } + if ((blendmode == 0) && (state[0].shape == state[1].shape)) fz_paint_pixmap(state[0].dest, state[1].dest, alpha * 255); else |