diff options
-rw-r--r-- | include/mupdf/fitz/config.h | 11 | ||||
-rw-r--r-- | source/fitz/draw-affine.c | 44 | ||||
-rw-r--r-- | source/fitz/draw-device.c | 4 | ||||
-rw-r--r-- | source/fitz/draw-paint.c | 26 |
4 files changed, 69 insertions, 16 deletions
diff --git a/include/mupdf/fitz/config.h b/include/mupdf/fitz/config.h index 82f926b2..7fc38c88 100644 --- a/include/mupdf/fitz/config.h +++ b/include/mupdf/fitz/config.h @@ -3,6 +3,12 @@ #define FZ_CONFIG_H /* + Enable the following for spot (and hence overprint/overprint + simulation) capable rendering. This forces FZ_PLOTTERS_N on. +*/ +#define FZ_ENABLE_SPOT_RENDERING + +/* Choose which plotters we need. By default we build all the plotters in. To avoid building plotters in that aren't needed, define the unwanted @@ -83,6 +89,11 @@ /* ---------- DO NOT EDIT ANYTHING UNDER THIS LINE ---------- */ +#ifndef FZ_ENABLE_SPOT_RENDERING +#undef FZ_PLOTTERS_N +#define FZ_PLOTTERS_N 1 +#endif /* FZ_ENABLE_SPOT_RENDERING */ + #ifndef FZ_PLOTTERS_G #define FZ_PLOTTERS_G 1 #endif /* FZ_PLOTTERS_G */ diff --git a/source/fitz/draw-affine.c b/source/fitz/draw-affine.c index 1af0a553..8c48eb54 100644 --- a/source/fitz/draw-affine.c +++ b/source/fitz/draw-affine.c @@ -1333,7 +1333,9 @@ paint_affine_lerp_alpha_N(byte * restrict dp, int da, const byte * restrict sp, TRACK_FN(); template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp); } +#endif /* FZ_PLOTTERS_N */ +#ifdef FZ_ENABLE_SPOT_RENDERING static void paint_affine_lerp_N_op(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int sa, int u, int v, int fa, int fb, int w, int dn, int sn, int alpha, const byte * restrict color, byte * restrict hp, const fz_overprint * restrict eop) { @@ -1347,11 +1349,12 @@ paint_affine_lerp_alpha_N_op(byte * restrict dp, int da, const byte * restrict s TRACK_FN(); template_affine_alpha_N_lerp_op(dp, da, sp, sw, sh, ss, sa, u, v, fa, fb, w, dn, sn, alpha, hp, eop); } -#endif /* FZ_PLOTTERS_N */ +#endif /* FZ_ENABLE_SPOT_RENDERING */ static paintfn_t * fz_paint_affine_lerp(int da, int sa, int fa, int fb, int n, int alpha, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) { if (alpha == 255) @@ -1361,6 +1364,8 @@ fz_paint_affine_lerp(int da, int sa, int fa, int fb, int n, int alpha, const fz_ else return NULL; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ + switch(n) { case 0: @@ -1547,6 +1552,7 @@ fallback: return NULL; } +#ifdef FZ_ENABLE_SPOT_RENDERING static paintfn_t * fz_paint_affine_lerp_spots(int da, int sa, int fa, int fb, int dn, int sn, int alpha, const fz_overprint * restrict eop) { @@ -1593,6 +1599,8 @@ fz_paint_affine_lerp_spots(int da, int sa, int fa, int fb, int dn, int sn, int a } return NULL; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ + #if FZ_PLOTTERS_RGB static void @@ -2454,7 +2462,9 @@ paint_affine_near_alpha_N(byte * restrict dp, int da, const byte * restrict sp, TRACK_FN(); template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp); } +#endif /* FZ_PLOTTERS_N */ +#ifdef FZ_ENABLE_SPOT_RENDERING static void paint_affine_near_N_op(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int sa, int u, int v, int fa, int fb, int w, int dn, int sn, int alpha, const byte * restrict color, byte * restrict hp, const fz_overprint * restrict eop) { @@ -2468,11 +2478,12 @@ paint_affine_near_alpha_N_op(byte * restrict dp, int da, const byte * restrict s TRACK_FN(); template_affine_alpha_N_near_op(dp, da, sp, sw, sh, ss, sa, u, v, fa, fb, w, dn, sn, alpha, hp, eop); } -#endif +#endif /* FZ_ENABLE_SPOT_RENDERING */ static paintfn_t * fz_paint_affine_near(int da, int sa, int fa, int fb, int n, int alpha, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) { if (alpha == 255) @@ -2482,6 +2493,7 @@ fz_paint_affine_near(int da, int sa, int fa, int fb, int n, int alpha, const fz_ else return NULL; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ switch(n) { case 0: @@ -2920,6 +2932,7 @@ fallback: return NULL; } +#ifdef FZ_ENABLE_SPOT_RENDERING static paintfn_t * fz_paint_affine_near_spots(int da, int sa, int fa, int fb, int dn, int sn, int alpha, const fz_overprint * restrict eop) { @@ -3022,6 +3035,7 @@ fz_paint_affine_near_spots(int da, int sa, int fa, int fb, int dn, int sn, int a } return NULL; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ #if FZ_PLOTTERS_RGB static void @@ -3370,20 +3384,24 @@ paint_affine_color_lerp_N(byte * restrict dp, int da, const byte * restrict sp, TRACK_FN(); template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp); } +#endif /* FZ_PLOTTERS_N */ +#ifdef FZ_ENABLE_SPOT_RENDERING static void paint_affine_color_lerp_N_op(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int sa, int u, int v, int fa, int fb, int w, int dn, int sn, int alpha, const byte * restrict color, byte * restrict hp, const fz_overprint * restrict eop) { TRACK_FN(); template_affine_color_N_lerp_op(dp, da, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, eop); } -#endif /* FZ_PLOTTERS_CMYK */ +#endif /* FZ_ENABLE_SPOT_RENDERING */ static paintfn_t * fz_paint_affine_color_lerp(int da, int sa, int fa, int fb, int n, int alpha, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) return paint_affine_color_lerp_N_op; +#endif /* FZ_ENABLE_SPOT_RENDERING */ switch (n) { case 0: return da ? paint_affine_color_lerp_da_0 : NULL; @@ -3403,17 +3421,15 @@ fz_paint_affine_color_lerp(int da, int sa, int fa, int fb, int n, int alpha, con return NULL; } +#ifdef FZ_ENABLE_SPOT_RENDERING static paintfn_t * fz_paint_affine_color_lerp_spots(int da, int sa, int fa, int fb, int dn, int sn, int alpha, const fz_overprint * restrict eop) { -#if FZ_PLOTTERS_N if (eop != NULL) return paint_affine_color_lerp_N_op; return da ? paint_affine_color_lerp_da_N : paint_affine_color_lerp_N; -#else - return NULL; -#endif /* FZ_PLOTTERS_N */ } +#endif /* FZ_ENABLE_SPOT_RENDERING */ static void paint_affine_color_near_da_0(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int sa, int u, int v, int fa, int fb, int w, int dn, int sn, int alpha, const byte * restrict color, byte * restrict hp, const fz_overprint * restrict eop) @@ -3484,7 +3500,9 @@ paint_affine_color_near_N(byte * restrict dp, int da, const byte * restrict sp, TRACK_FN(); template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp); } +#endif /* FZ_PLOTTERS_N */ +#ifdef FZ_ENABLE_SPOT_RENDERING static void paint_affine_color_near_da_N_op(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int sa, int u, int v, int fa, int fb, int w, int dn, int sn, int alpha, const byte * restrict color, byte * restrict hp, const fz_overprint * restrict eop) { @@ -3498,13 +3516,15 @@ paint_affine_color_near_N_op(byte * restrict dp, int da, const byte * restrict s TRACK_FN(); template_affine_color_N_near_op(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, eop); } -#endif /* FZ_PLOTTERS_N */ +#endif /* FZ_ENABLE_SPOT_RENDERING */ static paintfn_t * fz_paint_affine_color_near(int da, int sa, int fa, int fb, int n, int alpha, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) return da ? paint_affine_color_near_da_N_op : paint_affine_color_near_N_op; +#endif /* FZ_ENABLE_SPOT_RENDERING */ switch (n) { case 0: return da ? paint_affine_color_near_da_0 : NULL; @@ -3525,17 +3545,15 @@ fz_paint_affine_color_near(int da, int sa, int fa, int fb, int n, int alpha, con } } +#ifdef FZ_ENABLE_SPOT_RENDERING static paintfn_t * fz_paint_affine_color_near_spots(int da, int sa, int fa, int fb, int dn, int sn, int alpha, const fz_overprint * restrict eop) { -#if FZ_PLOTTERS_N if (eop != NULL) return paint_affine_color_near_N_op; return da ? paint_affine_color_near_da_N : paint_affine_color_near_N; -#else - return NULL; -#endif /* FZ_PLOTTERS_N */ } +#endif /* FZ_ENABLE_SPOT_RENDERING */ /* RJW: The following code was originally written to be sensitive to * FLT_EPSILON. Given the way the 'minimum representable difference' @@ -3846,6 +3864,7 @@ fz_paint_image_imp(fz_pixmap * restrict dst, const fz_irect *scissor, const fz_p } else #endif /* FZ_PLOTTERS_RGB */ +#ifdef FZ_ENABLE_SPOT_RENDERING if (sn != dn) { if (dolerp) @@ -3864,6 +3883,7 @@ fz_paint_image_imp(fz_pixmap * restrict dst, const fz_irect *scissor, const fz_p } } else +#endif /* FZ_ENABLE_SPOT_RENDERING */ { assert((!color && sn == dn) || (color && sn + sa == 1)); if (dolerp) diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 9ff734ec..6ba5a4cf 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -2680,7 +2680,11 @@ new_draw_device(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest, co * to trigger on later. */ if (dest->seps) +#ifdef FZ_ENABLE_SPOT_RENDERING dev->resolve_spots = 1; +#else + fz_throw(ctx, FZ_ERROR_GENERIC, "Spot rendering (and overprint/overprint simulation) not available in this build"); +#endif fz_try(ctx) { diff --git a/source/fitz/draw-paint.c b/source/fitz/draw-paint.c index a12f043a..3eb1c174 100644 --- a/source/fitz/draw-paint.c +++ b/source/fitz/draw-paint.c @@ -546,7 +546,9 @@ static void paint_solid_color_N_da(byte * restrict dp, int n, int w, const byte TRACK_FN(); template_solid_color_N_general(dp, n, w, color, 1, FZ_EXPAND(color[n-1])); } +#endif /* FZ_PLOTTERS_N */ +#ifdef FZ_ENABLE_SPOT_RENDERING static void paint_solid_color_N_alpha_op(byte * restrict dp, int n, int w, const byte * restrict color, int da, const fz_overprint * restrict eop) { TRACK_FN(); @@ -564,11 +566,12 @@ static void paint_solid_color_N_da_op(byte * restrict dp, int n, int w, const by TRACK_FN(); template_solid_color_N_general_op(dp, n, w, color, 1, FZ_EXPAND(color[n-1]), eop); } -#endif /* FZ_PLOTTERS_N */ +#endif /* FZ_ENABLE_SPOT_RENDERING */ fz_solid_color_painter_t * fz_get_solid_color_painter(int n, const byte * restrict color, int da, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) { if (da) @@ -578,6 +581,7 @@ fz_get_solid_color_painter(int n, const byte * restrict color, int da, const fz_ else return paint_solid_color_N_alpha_op; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ switch (n-da) { case 0: @@ -989,7 +993,9 @@ paint_span_with_color_N_da(byte * restrict dp, const byte * restrict mp, int n, TRACK_FN(); template_span_with_color_N_general(dp, mp, n, w, color, 1); } +#endif /* FZ_PLOTTERS_N */ +#ifdef FZ_ENABLE_SPOT_RENDERING static void paint_span_with_color_N_op(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da, const fz_overprint * restrict eop) { @@ -1003,15 +1009,17 @@ paint_span_with_color_N_da_op(byte * restrict dp, const byte * restrict mp, int TRACK_FN(); template_span_with_color_N_general_op(dp, mp, n, w, color, 1, eop); } -#endif /* FZ_PLOTTERS_N */ +#endif /* FZ_ENABLE_SPOT_RENDERING */ fz_span_color_painter_t * fz_get_span_color_painter(int n, int da, const byte * restrict color, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) { return da ? paint_span_with_color_N_da_op : paint_span_with_color_N_op; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ switch(n-da) { case 0: return da ? paint_span_with_color_0_da : NULL; @@ -1960,7 +1968,9 @@ paint_span_N_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, TRACK_FN(); template_span_N_with_alpha_general(dp, 0, sp, 0, n, w, alpha); } +#endif /* FZ_PLOTTERS_N */ +#ifdef FZ_ENABLE_SPOT_RENDERING static void paint_span_N_general_op(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha, const fz_overprint * restrict eop) { @@ -1974,11 +1984,12 @@ paint_span_N_general_alpha_op(byte * restrict dp, int da, const byte * restrict TRACK_FN(); template_span_N_with_alpha_general_op(dp, da, sp, sa, n, w, alpha, eop); } -#endif /* FZ_PLOTTERS_N */ +#endif /* FZ_ENABLE_SPOT_RENDERING */ fz_span_painter_t * fz_get_span_painter(int da, int sa, int n, int alpha, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) { if (alpha == 255) @@ -1988,6 +1999,7 @@ fz_get_span_painter(int da, int sa, int n, int alpha, const fz_overprint * restr else return NULL; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ switch (n) { case 0: @@ -2488,7 +2500,9 @@ intermediate_run: #include "paint-glyph.h" #include "paint-glyph.h" +#endif /* FZ_PLOTTERS_N */ +#ifdef FZ_ENABLE_SPOT_RENDERING #define ALPHA #define EOP #include "paint-glyph.h" @@ -2504,11 +2518,12 @@ intermediate_run: #define EOP #include "paint-glyph.h" -#endif /* FZ_PLOTTERS_N */ +#endif /* FZ_ENABLE_SPOT_RENDERING */ static inline void fz_paint_glyph_alpha(const unsigned char * restrict colorbv, int n, int span, unsigned char * restrict dp, int da, const fz_glyph *glyph, int w, int h, int skip_x, int skip_y, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) { if (da) @@ -2517,6 +2532,7 @@ fz_paint_glyph_alpha(const unsigned char * restrict colorbv, int n, int span, un fz_paint_glyph_alpha_N_op(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y, eop); return; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ switch (n) { case 1: @@ -2564,6 +2580,7 @@ fallback:{} static inline void fz_paint_glyph_solid(const unsigned char * restrict colorbv, int n, int span, unsigned char * restrict dp, int da, const fz_glyph * restrict glyph, int w, int h, int skip_x, int skip_y, const fz_overprint * restrict eop) { +#ifdef FZ_ENABLE_SPOT_RENDERING if (eop != NULL) { if (da) @@ -2572,6 +2589,7 @@ fz_paint_glyph_solid(const unsigned char * restrict colorbv, int n, int span, un fz_paint_glyph_solid_N_op(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y, eop); return; } +#endif /* FZ_ENABLE_SPOT_RENDERING */ switch (n) { case 1: |