diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-10-16 15:31:37 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-10-25 22:11:54 +0200 |
commit | f036f9efde139a8127b04ac32caeb9836c0ecabb (patch) | |
tree | fba4e5ee2bd9c06e09d10e78a71fa00fd868d8c3 /source/fitz | |
parent | 440087b3268787f2db313cee247d1166f2ee1802 (diff) | |
download | mupdf-f036f9efde139a8127b04ac32caeb9836c0ecabb.tar.xz |
Add and use fz_convert_pixmap_samples helper function.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/pixmap.c | 14 | ||||
-rw-r--r-- | source/fitz/separation.c | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c index a001b968..a5a00c24 100644 --- a/source/fitz/pixmap.c +++ b/source/fitz/pixmap.c @@ -626,16 +626,13 @@ fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, fz_irect b } else { - fz_pixmap_converter *pc = fz_lookup_pixmap_converter(ctx, dest->colorspace, src->colorspace); fz_pixmap fake_src = *src; - fake_src.x = b.x0; fake_src.y = b.y0; fake_src.w = w; fake_src.h = y; fake_src.samples = srcp; - - pc(ctx, dest, &fake_src, NULL, default_cs, fz_default_color_params(ctx), 0); + fz_convert_pixmap_samples(ctx, dest, &fake_src, NULL, default_cs, fz_default_color_params(ctx), 0); } } @@ -873,6 +870,12 @@ fz_pixmap_size(fz_context *ctx, fz_pixmap * pix) return sizeof(*pix) + pix->n * pix->w * pix->h; } +void fz_convert_pixmap_samples(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src, fz_colorspace *prf, const fz_default_colorspaces *default_cs, const fz_color_params *color_params, int copy_spots) +{ + fz_pixmap_converter *pc = fz_lookup_pixmap_converter(ctx, dst->colorspace, src->colorspace); + pc(ctx, dst, src, prf, default_cs, color_params, copy_spots); +} + fz_pixmap * fz_convert_pixmap(fz_context *ctx, fz_pixmap *pix, fz_colorspace *ds, fz_colorspace *prf, fz_default_colorspaces *default_cs, const fz_color_params *color_params, int keep_alpha) { @@ -897,8 +900,7 @@ fz_convert_pixmap(fz_context *ctx, fz_pixmap *pix, fz_colorspace *ds, fz_colorsp fz_try(ctx) { - fz_pixmap_converter *pc = fz_lookup_pixmap_converter(ctx, ds, pix->colorspace); - pc(ctx, cvt, pix, prf, default_cs, color_params, 1); + fz_convert_pixmap_samples(ctx, cvt, pix, prf, default_cs, color_params, 1); } fz_catch(ctx) { diff --git a/source/fitz/separation.c b/source/fitz/separation.c index bfaf6d6e..38466b31 100644 --- a/source/fitz/separation.c +++ b/source/fitz/separation.c @@ -683,8 +683,7 @@ fz_copy_pixmap_area_converting_seps(fz_context *ctx, fz_pixmap *dst, fz_pixmap * else { /* Use a standard pixmap converter to convert the process + alpha. */ - fz_pixmap_converter *pc = fz_lookup_pixmap_converter(ctx, dst->colorspace, src->colorspace); - pc(ctx, dst, src, proof_cs, default_cs, NULL, 0); + fz_convert_pixmap_samples(ctx, dst, src, proof_cs, default_cs, NULL, 0); /* And handle the spots ourselves. First make a map of what spots go where. */ /* We want to set it up so that: |