diff options
author | Robin Watts <robin.watts@artifex.com> | 2017-07-19 18:41:52 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2017-09-08 17:48:07 +0100 |
commit | d98776cdbcdd3abddf2185261df6b2f8c3ad01c2 (patch) | |
tree | eb1bdf8f60b00d4adecb0706db2017efe48bf128 /source/fitz/draw-device.c | |
parent | 7e4a177d55b3a290300f6671c0670e5a5897da24 (diff) | |
download | mupdf-d98776cdbcdd3abddf2185261df6b2f8c3ad01c2.tar.xz |
Start to rework plotters.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r-- | source/fitz/draw-device.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 6a6a7067..8c7ce352 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -1384,6 +1384,8 @@ fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, const fz_m fz_try(ctx) { + int conversion_required = (src_cs != model || state->dest->seps); + if (state->blendmode & FZ_BLEND_KNOCKOUT) state = fz_knockout_begin(ctx, dev); @@ -1391,9 +1393,15 @@ fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, const fz_m if (src_cs == fz_device_gray(ctx)) after = 1; - if (src_cs != model && !after) + if (conversion_required && !after) { - fz_pixmap *converted = fz_convert_pixmap(ctx, pixmap, model, prf, dev->default_cs, color_params, 1); + fz_pixmap *converted; + /* If we have a spotty image, and we are going to spotty output, + * then we can't lose the spots during color conversion. */ + if (fz_colorspace_is_device_n(ctx, src_cs) && state->dest->seps) + converted = fz_clone_pixmap_area_with_different_seps(ctx, pixmap, NULL, model, state->dest->seps, color_params, prf, dev->default_cs); + else + converted = fz_convert_pixmap(ctx, pixmap, model, prf, dev->default_cs, color_params, 1); fz_drop_pixmap(ctx, pixmap); pixmap = converted; } @@ -1417,18 +1425,23 @@ fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, const fz_m } } - if (src_cs != model && after) + if (conversion_required && after) { #if FZ_PLOTTERS_RGB - if ((src_cs == fz_device_gray(ctx) && model == fz_device_rgb(ctx)) || - (src_cs == fz_device_gray(ctx) && model == fz_device_bgr(ctx))) + if (state->dest->seps == NULL && + ((src_cs == fz_device_gray(ctx) && model == fz_device_rgb(ctx)) || + (src_cs == fz_device_gray(ctx) && model == fz_device_bgr(ctx)))) { /* We have special case rendering code for gray -> rgb/bgr */ } else #endif { - fz_pixmap *converted = fz_convert_pixmap(ctx, pixmap, model, prf, dev->default_cs, color_params, 1); + fz_pixmap *converted; + if (fz_colorspace_is_device_n(ctx, src_cs) && state->dest->seps) + converted = fz_clone_pixmap_area_with_different_seps(ctx, pixmap, NULL, model, state->dest->seps, color_params, prf, dev->default_cs); + else + converted = fz_convert_pixmap(ctx, pixmap, model, prf, dev->default_cs, color_params, 1); fz_drop_pixmap(ctx, pixmap); pixmap = converted; } |