From ba5dd08df9b477dbfa5ee9b2c5b56f41dfa8bc85 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Sat, 28 May 2016 18:14:45 +0100 Subject: Add config.h include file. Introduce FZ_PLOTTER defines to set which defines we required. Add FZ_ENABLE define to set which document handlers are built by default. --- source/fitz/document-all.c | 20 +- source/fitz/draw-affine.c | 1823 +++++++++++++++++++++++++------------------- source/fitz/draw-device.c | 2 + source/fitz/draw-edge.c | 6 + source/fitz/draw-paint.c | 1136 ++++++++++++++++----------- source/fitz/paint-glyph.h | 3 +- 6 files changed, 1743 insertions(+), 1247 deletions(-) (limited to 'source') diff --git a/source/fitz/document-all.c b/source/fitz/document-all.c index 3c1398e6..350e2f5e 100644 --- a/source/fitz/document-all.c +++ b/source/fitz/document-all.c @@ -2,15 +2,31 @@ void fz_register_document_handlers(fz_context *ctx) { +#if FZ_ENABLE_PDF fz_register_document_handler(ctx, &pdf_document_handler); +#endif /* FZ_ENABLE_PDF */ +#if FZ_ENABLE_XPS fz_register_document_handler(ctx, &xps_document_handler); +#endif /* FZ_ENABLE_XPS */ +#if FZ_ENABLE_SVG fz_register_document_handler(ctx, &svg_document_handler); +#endif /* FZ_ENABLE_SVG */ +#if FZ_ENABLE_CBZ fz_register_document_handler(ctx, &cbz_document_handler); +#endif /* FZ_ENABLE_CBZ */ +#if FZ_ENABLE_IMG fz_register_document_handler(ctx, &img_document_handler); +#endif /* FZ_ENABLE_IMG */ +#if FZ_ENABLE_TIFF fz_register_document_handler(ctx, &tiff_document_handler); +#endif /* FZ_ENABLE_TIFF */ +#if FZ_ENABLE_HTML fz_register_document_handler(ctx, &html_document_handler); +#endif /* FZ_ENABLE_HTML */ +#if FZ_ENABLE_EPUB fz_register_document_handler(ctx, &epub_document_handler); -#ifdef SUPPORT_GPROOF +#endif /* FZ_ENABLE_EPUB */ +#if FZ_ENABLE_GPRF fz_register_document_handler(ctx, &gprf_document_handler); -#endif +#endif /* FZ_ENABLE_GPRF */ } diff --git a/source/fitz/draw-affine.c b/source/fitz/draw-affine.c index 9e5c58cc..2738c188 100644 --- a/source/fitz/draw-affine.c +++ b/source/fitz/draw-affine.c @@ -27,7 +27,7 @@ static inline const byte *sample_nearest(const byte *s, int w, int h, int str, i /* Blend premultiplied source image in constant alpha over destination */ static inline void -fz_paint_affine_alpha_N_lerp(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 n1, int alpha, byte * restrict hp) +template_affine_alpha_N_lerp(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 n1, int alpha, byte * restrict hp) { int k; @@ -69,7 +69,7 @@ fz_paint_affine_alpha_N_lerp(byte * restrict dp, int da, const byte * restrict s /* Special case code for gray -> rgb */ static inline void -fz_paint_affine_alpha_g2rgb_lerp(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 alpha, byte * restrict hp) +template_affine_alpha_g2rgb_lerp(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 alpha, byte * restrict hp) { do { @@ -108,7 +108,7 @@ fz_paint_affine_alpha_g2rgb_lerp(byte * restrict dp, int da, const byte * restri } static inline void -fz_paint_affine_alpha_N_near_fa0(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 n1, int alpha, byte * restrict hp) +template_affine_alpha_N_near_fa0(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 n1, int alpha, byte * restrict hp) { int k; int ui = u >> 16; @@ -143,7 +143,7 @@ fz_paint_affine_alpha_N_near_fa0(byte * restrict dp, int da, const byte * restri } static inline void -fz_paint_affine_alpha_N_near_fb0(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 n1, int alpha, byte * restrict hp) +template_affine_alpha_N_near_fb0(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 n1, int alpha, byte * restrict hp) { int k; int vi = v >> 16; @@ -177,7 +177,7 @@ fz_paint_affine_alpha_N_near_fb0(byte * restrict dp, int da, const byte * restri } static inline void -fz_paint_affine_alpha_N_near(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 n1, int alpha, byte * restrict hp) +template_affine_alpha_N_near(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 n1, int alpha, byte * restrict hp) { int k; @@ -210,7 +210,7 @@ fz_paint_affine_alpha_N_near(byte * restrict dp, int da, const byte * restrict s } static inline void -fz_paint_affine_alpha_g2rgb_near_fa0(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 alpha, byte * restrict hp) +template_affine_alpha_g2rgb_near_fa0(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 alpha, byte * restrict hp) { int ui = u >> 16; if (ui < 0 || ui >= sw) @@ -245,7 +245,7 @@ fz_paint_affine_alpha_g2rgb_near_fa0(byte * restrict dp, int da, const byte * re } static inline void -fz_paint_affine_alpha_g2rgb_near_fb0(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 alpha, byte * restrict hp) +template_affine_alpha_g2rgb_near_fb0(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 alpha, byte * restrict hp) { int vi = v >> 16; if (vi < 0 || vi >= sh) @@ -280,7 +280,7 @@ fz_paint_affine_alpha_g2rgb_near_fb0(byte * restrict dp, int da, const byte * re } static inline void -fz_paint_affine_alpha_g2rgb_near(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 alpha, byte * restrict hp) +template_affine_alpha_g2rgb_near(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 alpha, byte * restrict hp) { do { @@ -314,7 +314,7 @@ fz_paint_affine_alpha_g2rgb_near(byte * restrict dp, int da, const byte * restri /* Blend premultiplied source image over destination */ static inline void -fz_paint_affine_N_lerp(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 n1, byte * restrict hp) +template_affine_N_lerp(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 n1, byte * restrict hp) { int k; @@ -355,7 +355,7 @@ fz_paint_affine_N_lerp(byte * restrict dp, int da, const byte * restrict sp, int } static inline void -fz_paint_affine_solid_g2rgb_lerp(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, byte * restrict hp) +template_affine_solid_g2rgb_lerp(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, byte * restrict hp) { do { @@ -393,7 +393,7 @@ fz_paint_affine_solid_g2rgb_lerp(byte * restrict dp, int da, const byte * restri } static inline void -fz_paint_affine_N_near_fa0(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 n1, byte * restrict hp) +template_affine_N_near_fa0(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 n1, byte * restrict hp) { int k; int ui = u >> 16; @@ -452,7 +452,7 @@ fz_paint_affine_N_near_fa0(byte * restrict dp, int da, const byte * restrict sp, } static inline void -fz_paint_affine_N_near_fb0(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 n1, byte * restrict hp) +template_affine_N_near_fb0(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 n1, byte * restrict hp) { int k; int vi = v >> 16; @@ -511,7 +511,7 @@ fz_paint_affine_N_near_fb0(byte * restrict dp, int da, const byte * restrict sp, } static inline void -fz_paint_affine_N_near(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 n1, byte * restrict hp) +template_affine_N_near(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 n1, byte * restrict hp) { int k; do @@ -568,7 +568,7 @@ fz_paint_affine_N_near(byte * restrict dp, int da, const byte * restrict sp, int } static inline void -fz_paint_affine_solid_g2rgb_near_fa0(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, byte * restrict hp) +template_affine_solid_g2rgb_near_fa0(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, byte * restrict hp) { int ui = u >> 16; if (ui < 0 || ui >= sw) @@ -616,7 +616,7 @@ fz_paint_affine_solid_g2rgb_near_fa0(byte * restrict dp, int da, const byte * re } static inline void -fz_paint_affine_solid_g2rgb_near_fb0(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, byte * restrict hp) +template_affine_solid_g2rgb_near_fb0(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, byte * restrict hp) { int vi = v >> 16; if (vi < 0 || vi >= sh) @@ -664,7 +664,7 @@ fz_paint_affine_solid_g2rgb_near_fb0(byte * restrict dp, int da, const byte * re } static inline void -fz_paint_affine_solid_g2rgb_near(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, byte * restrict hp) +template_affine_solid_g2rgb_near(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, byte * restrict hp) { do { @@ -712,7 +712,7 @@ fz_paint_affine_solid_g2rgb_near(byte * restrict dp, int da, const byte * restri /* Blend non-premultiplied color in source image mask over destination */ static inline void -fz_paint_affine_color_N_lerp(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int u, int v, int fa, int fb, int w, int n1, const byte * restrict color, byte * restrict hp) +template_affine_color_N_lerp(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int u, int v, int fa, int fb, int w, int n1, const byte * restrict color, byte * restrict hp) { int sa = color[n1]; int k; @@ -751,7 +751,7 @@ fz_paint_affine_color_N_lerp(byte * restrict dp, int da, const byte * restrict s } static inline void -fz_paint_affine_color_N_near(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int u, int v, int fa, int fb, int w, int n1, const byte * restrict color, byte * restrict hp) +template_affine_color_N_near(byte * restrict dp, int da, const byte * restrict sp, int sw, int sh, int ss, int u, int v, int fa, int fb, int w, int n1, const byte * restrict color, byte * restrict hp) { int sa = color[n1]; int k; @@ -783,416 +783,508 @@ fz_paint_affine_color_N_near(byte * restrict dp, int da, const byte * restrict s while (--w); } -/* LERP DA + SA Solid */ static void -fz_paint_affine_lerp_da_sa_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, hp); } static void -fz_paint_affine_lerp_da_sa_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_alpha_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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, alpha, hp); } static void -fz_paint_affine_lerp_da_sa_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, hp); } static void -fz_paint_affine_lerp_da_sa_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_alpha_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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, alpha, hp); } -/* LERP DA + SA Alpha */ static void -fz_paint_affine_lerp_da_sa_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_lerp_da_sa_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_lerp_da_sa_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_lerp_da_sa_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); } -/* LERP DA Solid */ +#if FZ_PLOTTERS_G static void -fz_paint_affine_lerp_da_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_lerp_da_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_lerp_da_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_sa_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); + template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_lerp_da_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_sa_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); } +#endif /* FZ_PLOTTERS_G */ -/* LERP DA Alpha */ +#if FZ_PLOTTERS_RGB static void -fz_paint_affine_lerp_da_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_lerp_da_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_lerp_da_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_lerp_da_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); } -/* LERP SA Solid */ static void -fz_paint_affine_lerp_sa_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_sa_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); + template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_lerp_sa_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_sa_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_lerp_sa_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); + template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_lerp_sa_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); } +#endif /* FZ_PLOTTERS_RGB */ -/* LERP SA Alpha */ +#if FZ_PLOTTERS_CMYK static void -fz_paint_affine_lerp_sa_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_lerp_sa_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_lerp_sa_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_lerp_sa_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); } -/* LERP Solid */ static void -fz_paint_affine_lerp_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_sa_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); + template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_lerp_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_sa_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_lerp_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); + template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_lerp_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); } +#endif /* FZ_PLOTTERS_CMYK */ -/* LERP Alpha */ +#if FZ_PLOTTERS_N static void -fz_paint_affine_lerp_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_lerp_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); } static void -fz_paint_affine_lerp_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_lerp_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); } +static void +paint_affine_lerp_sa_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +{ + TRACK_FN(); + template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); +} + +static void +paint_affine_lerp_sa_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +{ + TRACK_FN(); + template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); +} + +static void +paint_affine_lerp_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +{ + TRACK_FN(); + template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); +} + +static void +paint_affine_lerp_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +{ + TRACK_FN(); + template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); +} +#endif /* FZ_PLOTTERS_N */ + static paintfn_t * fz_paint_affine_lerp(int da, int sa, int fa, int fb, int n, int alpha) { - if (da) + switch(n) { - if (sa) - { - if (alpha == 255) + case 0: + if (!da) + return NULL; + if (sa) { - switch (n) - { - case 1: return fz_paint_affine_lerp_da_sa_1; - case 3: return fz_paint_affine_lerp_da_sa_3; - case 4: return fz_paint_affine_lerp_da_sa_4; - default: return fz_paint_affine_lerp_da_sa_N; - } + if (alpha == 255) + return paint_affine_lerp_da_sa_0; + else if (alpha > 0) + return paint_affine_lerp_da_sa_alpha_0; } - else if (alpha > 0) + else { - switch (n) + if (alpha == 255) + return paint_affine_lerp_da_0; + else if (alpha > 0) + return paint_affine_lerp_da_alpha_0; + } + break; + case 1: + if (sa) +#if FZ_PLOTTERS_G + if (da) { - case 1: return fz_paint_affine_lerp_da_sa_alpha_1; - case 3: return fz_paint_affine_lerp_da_sa_alpha_3; - case 4: return fz_paint_affine_lerp_da_sa_alpha_4; - default: return fz_paint_affine_lerp_da_sa_alpha_N; + if (alpha == 255) + return paint_affine_lerp_da_sa_1; + else if (alpha > 0) + return paint_affine_lerp_da_sa_alpha_1; } - } - } - else - { - if (alpha == 255) - { - switch (n) + else { - case 1: return fz_paint_affine_lerp_da_1; - case 3: return fz_paint_affine_lerp_da_3; - case 4: return fz_paint_affine_lerp_da_4; - default: return fz_paint_affine_lerp_da_N; + if (alpha == 255) + return paint_affine_lerp_sa_1; + else if (alpha > 0) + return paint_affine_lerp_sa_alpha_1; } - } - else if (alpha > 0) - { - switch (n) +#else + return NULL; +#endif /* FZ_PLOTTERS_H */ + else + if (da) { - case 1: return fz_paint_affine_lerp_da_alpha_1; - case 3: return fz_paint_affine_lerp_da_alpha_3; - case 4: return fz_paint_affine_lerp_da_alpha_4; - default: return fz_paint_affine_lerp_da_alpha_N; + if (alpha == 255) + return paint_affine_lerp_da_1; + else if (alpha > 0) + return paint_affine_lerp_da_alpha_1; } - } - } - } - else - { - if (sa) - { - if (alpha == 255) - { - switch (n) + else { - case 1: return fz_paint_affine_lerp_sa_1; - case 3: return fz_paint_affine_lerp_sa_3; - case 4: return fz_paint_affine_lerp_sa_4; - default: return fz_paint_affine_lerp_sa_N; + if (alpha == 255) + return paint_affine_lerp_1; + else if (alpha > 0) + return paint_affine_lerp_alpha_1; } - } - else if (alpha > 0) - { - switch (n) + break; +#if FZ_PLOTTERS_RGB + case 3: + if (da) + if (sa) { - case 1: return fz_paint_affine_lerp_sa_alpha_1; - case 3: return fz_paint_affine_lerp_sa_alpha_3; - case 4: return fz_paint_affine_lerp_sa_alpha_4; - default: return fz_paint_affine_lerp_sa_alpha_N; + if (alpha == 255) + return paint_affine_lerp_da_sa_3; + else if (alpha > 0) + return paint_affine_lerp_da_sa_alpha_3; } - } - } - else - { - if (alpha == 255) - { - switch (n) + else { - case 1: return fz_paint_affine_lerp_1; - case 3: return fz_paint_affine_lerp_3; - case 4: return fz_paint_affine_lerp_4; - default: return fz_paint_affine_lerp_N; + if (alpha == 255) + return paint_affine_lerp_da_3; + else if (alpha > 0) + return paint_affine_lerp_da_alpha_3; } - } - else if (alpha > 0) - { - switch (n) + else + if (sa) { - case 1: return fz_paint_affine_lerp_alpha_1; - case 3: return fz_paint_affine_lerp_alpha_3; - case 4: return fz_paint_affine_lerp_alpha_4; - default: return fz_paint_affine_lerp_alpha_N; + if (alpha == 255) + return paint_affine_lerp_sa_3; + else if (alpha > 0) + return paint_affine_lerp_sa_alpha_3; } - } - } + else + { + if (alpha == 255) + return paint_affine_lerp_3; + else if (alpha > 0) + return paint_affine_lerp_alpha_3; + } + break; +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: + if (da) + if (sa) + { + if (alpha == 255) + return paint_affine_lerp_da_sa_4; + else if (alpha > 0) + return paint_affine_lerp_da_sa_alpha_4; + } + else + { + if (alpha == 255) + return paint_affine_lerp_da_4; + else if (alpha > 0) + return paint_affine_lerp_da_alpha_4; + } + else + if (sa) + { + if (alpha == 255) + return paint_affine_lerp_sa_4; + else if (alpha > 0) + return paint_affine_lerp_sa_alpha_4; + } + else + { + if (alpha == 255) + return paint_affine_lerp_4; + else if (alpha > 0) + return paint_affine_lerp_alpha_4; + } + break; +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N + default: + if (da) + if (sa) + { + if (alpha == 255) + return paint_affine_lerp_da_sa_N; + else if (alpha > 0) + return paint_affine_lerp_da_sa_alpha_N; + } + else + { + if (alpha == 255) + return paint_affine_lerp_da_N; + else if (alpha > 0) + return paint_affine_lerp_da_alpha_N; + } + else + if (sa) + { + if (alpha == 255) + return paint_affine_lerp_sa_N; + else if (alpha > 0) + return paint_affine_lerp_sa_alpha_N; + } + else + { + if (alpha == 255) + return paint_affine_lerp_N; + else if (alpha > 0) + return paint_affine_lerp_alpha_N; + } + break; +#endif /* FZ_PLOTTERS_G */ } return NULL; } +#if FZ_PLOTTERS_RGB static void -fz_paint_affine_lerp_da_sa_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); } static void -fz_paint_affine_lerp_da_sa_g2rgb_alpha(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_sa_g2rgb_alpha(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_lerp_da_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); } static void -fz_paint_affine_lerp_da_g2rgb_alpha(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_da_g2rgb_alpha(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_lerp_sa_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_sa_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); } static void -fz_paint_affine_lerp_sa_g2rgb_alpha(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_sa_g2rgb_alpha(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_lerp_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); } static void -fz_paint_affine_lerp_g2rgb_alpha(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_lerp_g2rgb_alpha(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); } +#endif /* FZ_PLOTTERS_RGB */ static paintfn_t * fz_paint_affine_g2rgb_lerp(int da, int sa, int fa, int fb, int n, int alpha) { +#if FZ_PLOTTERS_RGB if (da) { if (sa) { if (alpha == 255) - return fz_paint_affine_lerp_da_sa_g2rgb; + return paint_affine_lerp_da_sa_g2rgb; else if (alpha > 0) - return fz_paint_affine_lerp_da_sa_g2rgb_alpha; + return paint_affine_lerp_da_sa_g2rgb_alpha; } else { if (alpha == 255) - return fz_paint_affine_lerp_da_g2rgb; + return paint_affine_lerp_da_g2rgb; else if (alpha > 0) - return fz_paint_affine_lerp_da_g2rgb_alpha; + return paint_affine_lerp_da_g2rgb_alpha; } } else @@ -1200,1272 +1292,1377 @@ fz_paint_affine_g2rgb_lerp(int da, int sa, int fa, int fb, int n, int alpha) if (sa) { if (alpha == 255) - return fz_paint_affine_lerp_sa_g2rgb; + return paint_affine_lerp_sa_g2rgb; else if (alpha > 0) - return fz_paint_affine_lerp_sa_g2rgb_alpha; + return paint_affine_lerp_sa_g2rgb_alpha; } else { if (alpha == 255) - return fz_paint_affine_lerp_g2rgb; + return paint_affine_lerp_g2rgb; else if (alpha > 0) - return fz_paint_affine_lerp_g2rgb_alpha; + return paint_affine_lerp_g2rgb_alpha; } } +#endif /* FZ_PLOTTERS_RGB */ return NULL; } -/* Near DA+SA Solid fa==0 */ static void -fz_paint_affine_near_da_sa_0_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_0_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, hp); } static void -fz_paint_affine_near_da_sa_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_0_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, alpha, hp); } static void -fz_paint_affine_near_da_sa_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_0_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, hp); } static void -fz_paint_affine_near_da_sa_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_0_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, alpha, hp); } static void -fz_paint_affine_near_da_sa_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_0_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, hp); } -/* Near DA+SA Alpha */ static void -fz_paint_affine_near_da_sa_alpha_0_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_0_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, alpha, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, alpha, hp); } static void -fz_paint_affine_near_da_sa_alpha_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_0_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, hp); } static void -fz_paint_affine_near_da_sa_alpha_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_0_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, alpha, hp); } static void -fz_paint_affine_near_da_sa_alpha_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, hp); } static void -fz_paint_affine_near_da_sa_alpha_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, alpha, hp); } -/* Near DA Solid */ static void -fz_paint_affine_near_da_0_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, hp); } static void -fz_paint_affine_near_da_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, alpha, hp); } static void -fz_paint_affine_near_da_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); + template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_da_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); + template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_da_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); + template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); } -/* Near DA Alpha */ static void -fz_paint_affine_near_da_alpha_0_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_near_da_alpha_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); + template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_near_da_alpha_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_near_da_alpha_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_da_alpha_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); } -/* Near SA Solid */ static void -fz_paint_affine_near_sa_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_sa_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_near_sa_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_sa_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); } -/* Near SA Alpha */ +#if FZ_PLOTTERS_G static void -fz_paint_affine_near_sa_alpha_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_sa_alpha_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_near_sa_alpha_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_sa_alpha_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); } -/* Near Solid */ static void -fz_paint_affine_near_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_near_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); + template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_near_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); } -/* Near Alpha */ static void -fz_paint_affine_near_alpha_1_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_alpha_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); } static void -fz_paint_affine_near_alpha_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); } static void -fz_paint_affine_near_alpha_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); } +#endif /* FZ_PLOTTERS_G */ -/* Near DA+SA Solid */ +#if FZ_PLOTTERS_RGB static void -fz_paint_affine_near_da_sa_0_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_sa_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_da_sa_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_sa_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_da_sa_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); + template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); } -/* Near DA+SA Alpha */ static void -fz_paint_affine_near_da_sa_alpha_0_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_da_sa_alpha_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_sa_alpha_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_3_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_da_sa_alpha_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_sa_alpha_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); } -/* Near DA Solid */ static void -fz_paint_affine_near_da_0_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_da_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_da_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); } -/* Near DA Alpha */ static void -fz_paint_affine_near_da_alpha_0_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, alpha, hp); + template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_alpha_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_alpha_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_da_alpha_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_da_alpha_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); + template_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); } -/* Near SA Solid */ static void -fz_paint_affine_near_sa_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_sa_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); } static void -fz_paint_affine_near_sa_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); + template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); } static void -fz_paint_affine_near_sa_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); } +#endif /* FZ_PLOTTERS_RGB */ -/* Near SA Alpha */ +#if FZ_PLOTTERS_CMYK static void -fz_paint_affine_near_sa_alpha_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_sa_alpha_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_near_sa_alpha_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_sa_alpha_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); } -/* Near Solid */ static void -fz_paint_affine_near_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); + template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_near_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); + template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_4_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); } -/* Near Alpha */ static void -fz_paint_affine_near_alpha_1_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_alpha_3_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_near_alpha_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_alpha_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); } -/* Near DA+SA Solid */ static void -fz_paint_affine_near_da_sa_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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, hp); + template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_da_sa_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); + template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_near_da_sa_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); + template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_da_sa_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_4_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); + template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_near_da_sa_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); } -/* Near DA+SA Alpha */ static void -fz_paint_affine_near_da_sa_alpha_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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, alpha, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_near_da_sa_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_da_sa_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); } static void -fz_paint_affine_near_da_sa_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_da_sa_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); } -/* Near DA Solid */ static void -fz_paint_affine_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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, hp); + template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); } static void -fz_paint_affine_near_da_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); + template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); } +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N static void -fz_paint_affine_near_da_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_da_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); } static void -fz_paint_affine_near_da_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); + template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); } -/* Near DA Alpha */ static void -fz_paint_affine_near_da_alpha_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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); } static void -fz_paint_affine_near_da_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_da_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); } static void -fz_paint_affine_near_da_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_da_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_N_fa0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); } -/* Near SA Solid */ static void -fz_paint_affine_near_sa_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_sa_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); } static void -fz_paint_affine_near_sa_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, hp); + template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_sa_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); } -/* Near SA Alpha */ static void -fz_paint_affine_near_sa_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_sa_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); } static void -fz_paint_affine_near_sa_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_sa_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_N_fb0(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); } -/* Near Solid */ static void -fz_paint_affine_near_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); } static void -fz_paint_affine_near_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, hp); + template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); + template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); } -/* Near Alpha */ static void -fz_paint_affine_near_alpha_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, alpha, hp); + template_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_alpha_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, alpha, hp); + template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, n, alpha, hp); } static void -fz_paint_affine_near_alpha_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, alpha, hp); + template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, hp); } static void -fz_paint_affine_near_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); + template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, n, alpha, hp); } +#endif static paintfn_t * fz_paint_affine_near(int da, int sa, int fa, int fb, int n, int alpha) { - if (da) + switch(n) { - if (sa) - { - if (alpha == 255) - { - if (fa == 0) + case 0: + if (da) + if (sa) + if (alpha == 255) { - switch (n) - { - case 0: return fz_paint_affine_near_da_sa_0_fa0; - case 1: return fz_paint_affine_near_da_sa_1_fa0; - case 3: return fz_paint_affine_near_da_sa_3_fa0; - case 4: return fz_paint_affine_near_da_sa_4_fa0; - default: return fz_paint_affine_near_da_sa_N_fa0; - } + if (fa == 0) + return paint_affine_near_da_sa_0_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_0_fb0; + else + return paint_affine_near_da_sa_0; } - else if (fb == 0) + else if (alpha > 0) { - switch (n) - { - case 0: return fz_paint_affine_near_da_sa_0_fb0; - case 1: return fz_paint_affine_near_da_sa_1_fb0; - case 3: return fz_paint_affine_near_da_sa_3_fb0; - case 4: return fz_paint_affine_near_da_sa_4_fb0; - default: return fz_paint_affine_near_da_sa_N_fb0; - } + if (fa == 0) + return paint_affine_near_da_sa_alpha_0_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_alpha_0_fb0; + else + return paint_affine_near_da_sa_alpha_0; } else + return NULL; + else + if (alpha == 255) { - switch (n) - { - case 0: return fz_paint_affine_near_da_sa_0; - case 1: return fz_paint_affine_near_da_sa_1; - case 3: return fz_paint_affine_near_da_sa_3; - case 4: return fz_paint_affine_near_da_sa_4; - default: return fz_paint_affine_near_da_sa_N; - } + if (fa == 0) + return paint_affine_near_da_0_fa0; + else if (fb == 0) + return paint_affine_near_da_0_fb0; + else + return paint_affine_near_da_0; } - } - else if (alpha > 0) + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_da_alpha_0_fa0; + else if (fb == 0) + return paint_affine_near_da_alpha_0_fb0; + else + return paint_affine_near_da_alpha_0; + } + else + return NULL; + else + return NULL; + case 1: + if (sa) +#if FZ_PLOTTERS_G + if (da) { - if (fa == 0) + if (alpha == 255) { - switch (n) - { - case 0: return fz_paint_affine_near_da_sa_alpha_0_fa0; - case 1: return fz_paint_affine_near_da_sa_alpha_1_fa0; - case 3: return fz_paint_affine_near_da_sa_alpha_3_fa0; - case 4: return fz_paint_affine_near_da_sa_alpha_4_fa0; - default: return fz_paint_affine_near_da_sa_alpha_N_fa0; - } + if (fa == 0) + return paint_affine_near_da_sa_1_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_1_fb0; + else + return paint_affine_near_da_sa_1; } - else if (fb == 0) + else if (alpha > 0) { - switch (n) - { - case 0: return fz_paint_affine_near_da_sa_alpha_0_fb0; - case 1: return fz_paint_affine_near_da_sa_alpha_1_fb0; - case 3: return fz_paint_affine_near_da_sa_alpha_3_fb0; - case 4: return fz_paint_affine_near_da_sa_alpha_4_fb0; - default: return fz_paint_affine_near_da_sa_alpha_N_fb0; - } + if (fa == 0) + return paint_affine_near_da_sa_alpha_1_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_alpha_1_fb0; + else + return paint_affine_near_da_sa_alpha_1; } - else + } + else + { + if (alpha == 255) { - switch (n) - { - case 0: return fz_paint_affine_near_da_sa_alpha_0; - case 1: return fz_paint_affine_near_da_sa_alpha_1; - case 3: return fz_paint_affine_near_da_sa_alpha_3; - case 4: return fz_paint_affine_near_da_sa_alpha_4; - default: return fz_paint_affine_near_da_sa_alpha_N; - } + if (fa == 0) + return paint_affine_near_sa_1_fa0; + else if (fb == 0) + return paint_affine_near_sa_1_fb0; + else + return paint_affine_near_sa_1; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_sa_alpha_1_fa0; + else if (fb == 0) + return paint_affine_near_sa_alpha_1_fb0; + else + return paint_affine_near_sa_alpha_1; } } - } +#else + return NULL; +#endif /* FZ_PLOTTERS_G */ else - { - if (alpha == 255) + if (da) { - if (fa == 0) + if (alpha == 255) { - switch (n) - { - case 0: return fz_paint_affine_near_da_0_fa0; - case 1: return fz_paint_affine_near_da_1_fa0; - case 3: return fz_paint_affine_near_da_3_fa0; - case 4: return fz_paint_affine_near_da_4_fa0; - default: return fz_paint_affine_near_da_N_fa0; - } + if (fa == 0) + return paint_affine_near_da_1_fa0; + else if (fb == 0) + return paint_affine_near_da_1_fb0; + else + return paint_affine_near_da_1; } - else if (fb == 0) + else if (alpha > 0) { - switch (n) - { - case 0: return fz_paint_affine_near_da_0_fb0; - case 1: return fz_paint_affine_near_da_1_fb0; - case 3: return fz_paint_affine_near_da_3_fb0; - case 4: return fz_paint_affine_near_da_4_fb0; - default: return fz_paint_affine_near_da_N_fb0; - } + if (fa == 0) + return paint_affine_near_da_alpha_1_fa0; + else if (fb == 0) + return paint_affine_near_da_alpha_1_fb0; + else + return paint_affine_near_da_alpha_1; } - else + } + else + { + if (alpha == 255) { - switch (n) - { - case 0: return fz_paint_affine_near_da_0; - case 1: return fz_paint_affine_near_da_1; - case 3: return fz_paint_affine_near_da_3; - case 4: return fz_paint_affine_near_da_4; - default: return fz_paint_affine_near_da_N; - } + if (fa == 0) + return paint_affine_near_1_fa0; + else if (fb == 0) + return paint_affine_near_1_fb0; + else + return paint_affine_near_1; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_alpha_1_fa0; + else if (fb == 0) + return paint_affine_near_alpha_1_fb0; + else + return paint_affine_near_alpha_1; } } - else if (alpha > 0) + break; +#if FZ_PLOTTERS_RGB + case 3: + if (da) + if (sa) { - if (fa == 0) + if (alpha == 255) { - switch (n) - { - case 0: return fz_paint_affine_near_da_alpha_0_fa0; - case 1: return fz_paint_affine_near_da_alpha_1_fa0; - case 3: return fz_paint_affine_near_da_alpha_3_fa0; - case 4: return fz_paint_affine_near_da_alpha_4_fa0; - default: return fz_paint_affine_near_da_alpha_N_fa0; - } + if (fa == 0) + return paint_affine_near_da_sa_3_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_3_fb0; + else + return paint_affine_near_da_sa_3; } - else if (fb == 0) + else if (alpha > 0) { - switch (n) - { - case 0: return fz_paint_affine_near_da_alpha_0_fb0; - case 1: return fz_paint_affine_near_da_alpha_1_fb0; - case 3: return fz_paint_affine_near_da_alpha_3_fb0; - case 4: return fz_paint_affine_near_da_alpha_4_fb0; - default: return fz_paint_affine_near_da_alpha_N_fb0; - } + if (fa == 0) + return paint_affine_near_da_sa_alpha_3_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_alpha_3_fb0; + else + return paint_affine_near_da_sa_alpha_3; } - else + } + else + { + if (alpha == 255) { - switch (n) - { - case 0: return fz_paint_affine_near_da_alpha_0; - case 1: return fz_paint_affine_near_da_alpha_1; - case 3: return fz_paint_affine_near_da_alpha_3; - case 4: return fz_paint_affine_near_da_alpha_4; - default: return fz_paint_affine_near_da_alpha_N; - } + if (fa == 0) + return paint_affine_near_da_3_fa0; + else if (fb == 0) + return paint_affine_near_da_3_fb0; + else + return paint_affine_near_da_3; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_da_alpha_3_fa0; + else if (fb == 0) + return paint_affine_near_da_alpha_3_fb0; + else + return paint_affine_near_da_alpha_3; } } - } - } - else - { - if (sa) - { - if (alpha == 255) + else + if (sa) { - if (fa == 0) + if (alpha == 255) { - switch (n) - { - case 1: return fz_paint_affine_near_sa_1_fa0; - case 3: return fz_paint_affine_near_sa_3_fa0; - case 4: return fz_paint_affine_near_sa_4_fa0; - default: return fz_paint_affine_near_sa_N_fa0; - } + if (fa == 0) + return paint_affine_near_sa_3_fa0; + else if (fb == 0) + return paint_affine_near_sa_3_fb0; + else + return paint_affine_near_sa_3; } - else if (fb == 0) + else if (alpha > 0) { - switch (n) - { - case 1: return fz_paint_affine_near_sa_1_fb0; - case 3: return fz_paint_affine_near_sa_3_fb0; - case 4: return fz_paint_affine_near_sa_4_fb0; - default: return fz_paint_affine_near_sa_N_fb0; - } + if (fa == 0) + return paint_affine_near_sa_alpha_3_fa0; + else if (fb == 0) + return paint_affine_near_sa_alpha_3_fb0; + else + return paint_affine_near_sa_alpha_3; } - else + } + else + { + if (alpha == 255) { - switch (n) - { - case 1: return fz_paint_affine_near_sa_1; - case 3: return fz_paint_affine_near_sa_3; - case 4: return fz_paint_affine_near_sa_4; - default: return fz_paint_affine_near_sa_N; - } + if (fa == 0) + return paint_affine_near_3_fa0; + else if (fb == 0) + return paint_affine_near_3_fb0; + else + return paint_affine_near_3; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_alpha_3_fa0; + else if (fb == 0) + return paint_affine_near_alpha_3_fb0; + else + return paint_affine_near_alpha_3; } } - else if (alpha > 0) +#endif /* FZ_PLOTTERS_RGB */ + break; +#if FZ_PLOTTERS_CMYK + case 4: + if (da) + if (sa) { - if (fa == 0) + if (alpha == 255) { - switch (n) - { - case 1: return fz_paint_affine_near_sa_alpha_1_fa0; - case 3: return fz_paint_affine_near_sa_alpha_3_fa0; - case 4: return fz_paint_affine_near_sa_alpha_4_fa0; - default: return fz_paint_affine_near_sa_alpha_N_fa0; - } + if (fa == 0) + return paint_affine_near_da_sa_4_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_4_fb0; + else + return paint_affine_near_da_sa_4; } - else if (fb == 0) + else if (alpha > 0) { - switch (n) - { - case 1: return fz_paint_affine_near_sa_alpha_1_fb0; - case 3: return fz_paint_affine_near_sa_alpha_3_fb0; - case 4: return fz_paint_affine_near_sa_alpha_4_fb0; - default: return fz_paint_affine_near_sa_alpha_N_fb0; - } + if (fa == 0) + return paint_affine_near_da_sa_alpha_4_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_alpha_4_fb0; + else + return paint_affine_near_da_sa_alpha_4; } - else + } + else + { + if (alpha == 255) { - switch (n) - { - case 1: return fz_paint_affine_near_sa_alpha_1; - case 3: return fz_paint_affine_near_sa_alpha_3; - case 4: return fz_paint_affine_near_sa_alpha_4; - default: return fz_paint_affine_near_sa_alpha_N; - } + if (fa == 0) + return paint_affine_near_da_4_fa0; + else if (fb == 0) + return paint_affine_near_da_4_fb0; + else + return paint_affine_near_da_4; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_da_alpha_4_fa0; + else if (fb == 0) + return paint_affine_near_da_alpha_4_fb0; + else + return paint_affine_near_da_alpha_4; } } - } else - { - if (alpha == 255) + if (sa) { - if (fa == 0) + if (alpha == 255) { - switch (n) - { - case 1: return fz_paint_affine_near_1_fa0; - case 3: return fz_paint_affine_near_3_fa0; - case 4: return fz_paint_affine_near_4_fa0; - default: return fz_paint_affine_near_N_fa0; - } + if (fa == 0) + return paint_affine_near_sa_4_fa0; + else if (fb == 0) + return paint_affine_near_sa_4_fb0; + else + return paint_affine_near_sa_4; } - else if (fb == 0) + else if (alpha > 0) { - switch (n) - { - case 1: return fz_paint_affine_near_1_fb0; - case 3: return fz_paint_affine_near_3_fb0; - case 4: return fz_paint_affine_near_4_fb0; - default: return fz_paint_affine_near_N_fb0; - } + if (fa == 0) + return paint_affine_near_sa_alpha_4_fa0; + else if (fb == 0) + return paint_affine_near_sa_alpha_4_fb0; + else + return paint_affine_near_sa_alpha_4; } - else + } + else + { + if (alpha == 255) { - switch (n) - { - case 1: return fz_paint_affine_near_1; - case 3: return fz_paint_affine_near_3; - case 4: return fz_paint_affine_near_4; - default: return fz_paint_affine_near_N; - } + if (fa == 0) + return paint_affine_near_4_fa0; + else if (fb == 0) + return paint_affine_near_4_fb0; + else + return paint_affine_near_4; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_alpha_4_fa0; + else if (fb == 0) + return paint_affine_near_alpha_4_fb0; + else + return paint_affine_near_alpha_4; } } - else if (alpha > 0) +#endif /* FZ_PLOTTERS_CMYK */ + break; +#if FZ_PLOTTERS_N + default: + if (da) + if (sa) { - if (fa == 0) + if (alpha == 255) { - switch (n) - { - case 1: return fz_paint_affine_near_alpha_1_fa0; - case 3: return fz_paint_affine_near_alpha_3_fa0; - case 4: return fz_paint_affine_near_alpha_4_fa0; - default: return fz_paint_affine_near_alpha_N_fa0; - } + if (fa == 0) + return paint_affine_near_da_sa_N_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_N_fb0; + else + return paint_affine_near_da_sa_N; } - else if (fb == 0) + else if (alpha > 0) { - switch (n) - { - case 1: return fz_paint_affine_near_alpha_1_fb0; - case 3: return fz_paint_affine_near_alpha_3_fb0; - case 4: return fz_paint_affine_near_alpha_4_fb0; - default: return fz_paint_affine_near_alpha_N_fb0; - } + if (fa == 0) + return paint_affine_near_da_sa_alpha_N_fa0; + else if (fb == 0) + return paint_affine_near_da_sa_alpha_N_fb0; + else + return paint_affine_near_da_sa_alpha_N; } - else + } + else + { + if (alpha == 255) { - switch (n) - { - case 1: return fz_paint_affine_near_alpha_1; - case 3: return fz_paint_affine_near_alpha_3; - case 4: return fz_paint_affine_near_alpha_4; - default: return fz_paint_affine_near_alpha_N; - } + if (fa == 0) + return paint_affine_near_da_N_fa0; + else if (fb == 0) + return paint_affine_near_da_N_fb0; + else + return paint_affine_near_da_N; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_da_alpha_N_fa0; + else if (fb == 0) + return paint_affine_near_da_alpha_N_fb0; + else + return paint_affine_near_da_alpha_N; } } - } + else + if (sa) + { + if (alpha == 255) + { + if (fa == 0) + return paint_affine_near_sa_N_fa0; + else if (fb == 0) + return paint_affine_near_sa_N_fb0; + else + return paint_affine_near_sa_N; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_sa_alpha_N_fa0; + else if (fb == 0) + return paint_affine_near_sa_alpha_N_fb0; + else + return paint_affine_near_sa_alpha_N; + } + } + else + { + if (alpha == 255) + { + if (fa == 0) + return paint_affine_near_N_fa0; + else if (fb == 0) + return paint_affine_near_N_fb0; + else + return paint_affine_near_N; + } + else if (alpha > 0) + { + if (fa == 0) + return paint_affine_near_alpha_N_fa0; + else if (fb == 0) + return paint_affine_near_alpha_N_fb0; + else + return paint_affine_near_alpha_N; + } + } +#endif /* FZ_PLOTTERS_N */ + break; } return NULL; } +#if FZ_PLOTTERS_RGB static void -fz_paint_affine_near_da_sa_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_da_sa_alpha_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_da_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_da_alpha_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_sa_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_sa_alpha_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_alpha_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_g2rgb_fa0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_da_sa_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_da_sa_alpha_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_da_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_da_alpha_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_sa_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_sa_alpha_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_alpha_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_g2rgb_fb0(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_da_sa_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_da_sa_alpha_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_sa_alpha_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_da_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_da_alpha_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_da_alpha_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_sa_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_sa_alpha_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_sa_alpha_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp); } static void -fz_paint_affine_near_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_solid_g2rgb_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); + template_affine_solid_g2rgb_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp); } static void -fz_paint_affine_near_alpha_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_near_alpha_g2rgb(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 n1, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_alpha_g2rgb_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); + template_affine_alpha_g2rgb_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp); } +#endif /* FZ_PLOTTERS_RGB */ static paintfn_t * fz_paint_affine_g2rgb_near(int da, int sa, int fa, int fb, int n, int alpha) { +#if FZ_PLOTTERS_RGB if (da) { if (sa) @@ -2473,23 +2670,23 @@ fz_paint_affine_g2rgb_near(int da, int sa, int fa, int fb, int n, int alpha) if (fa == 0) { if (alpha == 255) - return fz_paint_affine_near_da_sa_g2rgb_fa0; + return paint_affine_near_da_sa_g2rgb_fa0; else if (alpha > 0) - return fz_paint_affine_near_da_sa_alpha_g2rgb_fa0; + return paint_affine_near_da_sa_alpha_g2rgb_fa0; } else if (fb == 0) { if (alpha == 255) - return fz_paint_affine_near_da_sa_g2rgb_fb0; + return paint_affine_near_da_sa_g2rgb_fb0; else if (alpha > 0) - return fz_paint_affine_near_da_sa_alpha_g2rgb_fb0; + return paint_affine_near_da_sa_alpha_g2rgb_fb0; } else { if (alpha == 255) - return fz_paint_affine_near_da_sa_g2rgb; + return paint_affine_near_da_sa_g2rgb; else if (alpha > 0) - return fz_paint_affine_near_da_sa_alpha_g2rgb; + return paint_affine_near_da_sa_alpha_g2rgb; } } else @@ -2497,23 +2694,23 @@ fz_paint_affine_g2rgb_near(int da, int sa, int fa, int fb, int n, int alpha) if (fa == 0) { if (alpha == 255) - return fz_paint_affine_near_da_g2rgb_fa0; + return paint_affine_near_da_g2rgb_fa0; else if (alpha > 0) - return fz_paint_affine_near_da_alpha_g2rgb_fa0; + return paint_affine_near_da_alpha_g2rgb_fa0; } else if (fb == 0) { if (alpha == 255) - return fz_paint_affine_near_da_g2rgb_fb0; + return paint_affine_near_da_g2rgb_fb0; else if (alpha > 0) - return fz_paint_affine_near_da_alpha_g2rgb_fb0; + return paint_affine_near_da_alpha_g2rgb_fb0; } else { if (alpha == 255) - return fz_paint_affine_near_da_g2rgb; + return paint_affine_near_da_g2rgb; else if (alpha > 0) - return fz_paint_affine_near_da_alpha_g2rgb; + return paint_affine_near_da_alpha_g2rgb; } } } @@ -2524,23 +2721,23 @@ fz_paint_affine_g2rgb_near(int da, int sa, int fa, int fb, int n, int alpha) if (fa == 0) { if (alpha == 255) - return fz_paint_affine_near_sa_g2rgb_fa0; + return paint_affine_near_sa_g2rgb_fa0; else if (alpha > 0) - return fz_paint_affine_near_sa_alpha_g2rgb_fa0; + return paint_affine_near_sa_alpha_g2rgb_fa0; } else if (fb == 0) { if (alpha == 255) - return fz_paint_affine_near_sa_g2rgb_fb0; + return paint_affine_near_sa_g2rgb_fb0; else if (alpha > 0) - return fz_paint_affine_near_sa_alpha_g2rgb_fb0; + return paint_affine_near_sa_alpha_g2rgb_fb0; } else { if (alpha == 255) - return fz_paint_affine_near_sa_g2rgb; + return paint_affine_near_sa_g2rgb; else if (alpha > 0) - return fz_paint_affine_near_sa_alpha_g2rgb; + return paint_affine_near_sa_alpha_g2rgb; } } else @@ -2548,191 +2745,215 @@ fz_paint_affine_g2rgb_near(int da, int sa, int fa, int fb, int n, int alpha) if (fa == 0) { if (alpha == 255) - return fz_paint_affine_near_g2rgb_fa0; + return paint_affine_near_g2rgb_fa0; else if (alpha > 0) - return fz_paint_affine_near_alpha_g2rgb_fa0; + return paint_affine_near_alpha_g2rgb_fa0; } else if (fb == 0) { if (alpha == 255) - return fz_paint_affine_near_g2rgb_fb0; + return paint_affine_near_g2rgb_fb0; else if (alpha > 0) - return fz_paint_affine_near_alpha_g2rgb_fb0; + return paint_affine_near_alpha_g2rgb_fb0; } else { if (alpha == 255) - return fz_paint_affine_near_g2rgb; + return paint_affine_near_g2rgb; else if (alpha > 0) - return fz_paint_affine_near_alpha_g2rgb; + return paint_affine_near_alpha_g2rgb; } } } +#endif /* FZ_PLOTTERS_G */ return NULL; } static void -fz_paint_affine_color_lerp_da_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_lerp_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 n, int alpha, const byte * restrict color, byte * restrict hp) +{ + TRACK_FN(); + template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 0, color, hp); +} + +#if FZ_PLOTTERS_G +static void +paint_affine_color_lerp_da_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 1, color, hp); + template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 1, color, hp); } static void -fz_paint_affine_color_lerp_da_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_lerp_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 3, color, hp); + template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 1, color, hp); } +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB static void -fz_paint_affine_color_lerp_da_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_lerp_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 4, color, hp); + template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 3, color, hp); } static void -fz_paint_affine_color_lerp_da_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_lerp_da_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, n, color, hp); + template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 3, color, hp); } +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK static void -fz_paint_affine_color_lerp_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_lerp_da_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 1, color, hp); + template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 4, color, hp); } static void -fz_paint_affine_color_lerp_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_lerp_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 3, color, hp); + template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 4, color, hp); } +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_N static void -fz_paint_affine_color_lerp_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_lerp_da_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 4, color, hp); + template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, n, color, hp); } static void -fz_paint_affine_color_lerp_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_lerp_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, n, color, hp); + template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, n, color, hp); } +#endif /* FZ_PLOTTERS_CMYK */ static paintfn_t * fz_paint_affine_color_lerp(int da, int sa, int fa, int fb, int n, int alpha) { - if (da) + switch (n) { - switch (n) - { - case 1: return fz_paint_affine_color_lerp_da_1; - case 3: return fz_paint_affine_color_lerp_da_3; - case 4: return fz_paint_affine_color_lerp_da_4; - default: return fz_paint_affine_color_lerp_da_N; - } - } - else - { - switch (n) - { - case 1: return fz_paint_affine_color_lerp_1; - case 3: return fz_paint_affine_color_lerp_3; - case 4: return fz_paint_affine_color_lerp_4; - default: return fz_paint_affine_color_lerp_N; - } + case 0: return da ? paint_affine_color_lerp_da_0 : NULL; +#if FZ_PLOTTERS_G + case 1: return da ? paint_affine_color_lerp_da_1 : paint_affine_color_lerp_1; +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB + case 3: return da ? paint_affine_color_lerp_da_3 : paint_affine_color_lerp_3; +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: return da ? paint_affine_color_lerp_da_4 : paint_affine_color_lerp_4; +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N + default: return da ? paint_affine_color_lerp_da_N : paint_affine_color_lerp_N; +#endif /* FZ_PLOTTERS_N */ } return NULL; } static void -fz_paint_affine_color_near_da_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +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 n, int alpha, const byte * restrict color, byte * restrict hp) +{ + TRACK_FN(); + template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 0, color, hp); +} + +#if FZ_PLOTTERS_G +static void +paint_affine_color_near_da_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 1, color, hp); + template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 1, color, hp); } static void -fz_paint_affine_color_near_da_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_near_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 3, color, hp); + template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 1, color, hp); } +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB static void -fz_paint_affine_color_near_da_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_near_da_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 4, color, hp); + template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 3, color, hp); } static void -fz_paint_affine_color_near_da_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_near_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, n, color, hp); + template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 3, color, hp); } +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK static void -fz_paint_affine_color_near_1(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_near_da_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 1, color, hp); + template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 4, color, hp); } static void -fz_paint_affine_color_near_3(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_near_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 3, color, hp); + template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 4, color, hp); } +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N static void -fz_paint_affine_color_near_4(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_near_da_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 4, color, hp); + template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, n, color, hp); } static void -fz_paint_affine_color_near_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) +paint_affine_color_near_N(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 n, int alpha, const byte * restrict color, byte * restrict hp) { TRACK_FN(); - fz_paint_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, n, color, hp); + template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, n, color, hp); } +#endif /* FZ_PLOTTERS_N */ static paintfn_t * fz_paint_affine_color_near(int da, int sa, int fa, int fb, int n, int alpha) { - if (da) - { - switch (n) - { - case 1: return fz_paint_affine_color_near_da_1; - case 3: return fz_paint_affine_color_near_da_3; - case 4: return fz_paint_affine_color_near_da_4; - default: return fz_paint_affine_color_near_da_N; - } - } - else + switch (n) { - switch (n) - { - case 1: return fz_paint_affine_color_near_1; - case 3: return fz_paint_affine_color_near_3; - case 4: return fz_paint_affine_color_near_4; - default: return fz_paint_affine_color_near_N; - } + case 0: return da ? paint_affine_color_near_da_0 : NULL; +#if FZ_PLOTTERS_G + case 1: return da ? paint_affine_color_near_da_1 : paint_affine_color_near_1; +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB + case 3: return da ? paint_affine_color_near_da_3 : paint_affine_color_near_3; +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: return da ? paint_affine_color_near_da_4 : paint_affine_color_near_4; +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N + default: return da ? paint_affine_color_near_da_N : paint_affine_color_near_N; +#else + default: return NULL; +#endif /* FZ_PLOTTERS_N */ } - return NULL; } /* RJW: The following code was originally written to be sensitive to diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 202e24dd..99032df9 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -577,6 +577,7 @@ draw_glyph(unsigned char *colorbv, fz_pixmap *dst, fz_glyph *glyph, fz_span_color_painter_t *fn; fn = fz_get_span_color_painter(dst->n, da, colorbv); + assert(fn); if (fn == NULL) return; while (h--) @@ -591,6 +592,7 @@ draw_glyph(unsigned char *colorbv, fz_pixmap *dst, fz_glyph *glyph, fz_span_painter_t *fn; fn = fz_get_span_painter(da, 1, 0, 255); + assert(fn); if (fn == NULL) return; while (h--) diff --git a/source/fitz/draw-edge.c b/source/fitz/draw-edge.c index 859d1ef1..03739ee1 100644 --- a/source/fitz/draw-edge.c +++ b/source/fitz/draw-edge.c @@ -1147,11 +1147,17 @@ fz_scan_convert(fz_context *ctx, fz_gel *gel, int eofill, const fz_irect *clip, fn = (void *)fz_get_span_color_painter(dst->n, dst->alpha, color); else fn = (void *)fz_get_span_painter(dst->alpha, 1, 0, 255); + assert(fn); + if (fn == NULL) + return; fz_scan_convert_aa(ctx, gel, eofill, &local_clip, dst, color, fn); } else { fz_solid_color_painter_t *fn = fz_get_solid_color_painter(dst->n, color, dst->alpha); + assert(fn); + if (fn == NULL) + return; fz_scan_convert_sharp(ctx, gel, eofill, &local_clip, dst, color, (fz_solid_color_painter_t *)fn); } } diff --git a/source/fitz/draw-paint.c b/source/fitz/draw-paint.c index ef08dc98..51a84bc2 100644 --- a/source/fitz/draw-paint.c +++ b/source/fitz/draw-paint.c @@ -76,7 +76,7 @@ typedef unsigned char byte; /* These are used by the non-aa scan converter */ static inline void -fz_paint_solid_color_2_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) +template_solid_color_1_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) { int sa = FZ_EXPAND(color[1]); TRACK_FN(); @@ -111,7 +111,7 @@ static inline int isbigendian(void) } static inline void -fz_paint_solid_color_4_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) +template_solid_color_3_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) { unsigned int rgba = *(int *)color; int sa = FZ_EXPAND(color[3]); @@ -153,7 +153,7 @@ fz_paint_solid_color_4_da(byte * restrict dp, int n, int w, const byte * restric } static inline void -fz_paint_solid_color_5_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) +template_solid_color_4_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) { int sa = FZ_EXPAND(color[4]); TRACK_FN(); @@ -236,64 +236,97 @@ fz_paint_solid_color_5_da(byte * restrict dp, int n, int w, const byte * restric } static inline void -fz_paint_solid_color_N_general(byte * restrict dp, int n, int w, const byte * restrict color, int da) +template_solid_color_N_256(byte * restrict dp, int n, int w, const byte * restrict color, int da) { int k; int n1 = n - da; - int sa = FZ_EXPAND(color[n1]); - TRACK_FN(); - if (sa == 0) - return; - if (sa == 256) + if (n == 3 && da == 0 && w >= 8) { - if (n == 3 && w >= 8) - { - union {uint32_t w[3]; byte b[12];} u; + union {uint32_t w[3]; byte b[12];} u; - u.b[0] = u.b[3] = u.b[6] = u.b[9] = color[0]; - u.b[1] = u.b[4] = u.b[7] = u.b[10] = color[1]; - u.b[2] = u.b[5] = u.b[8] = u.b[11] = color[2]; + u.b[0] = u.b[3] = u.b[6] = u.b[9] = color[0]; + u.b[1] = u.b[4] = u.b[7] = u.b[10] = color[1]; + u.b[2] = u.b[5] = u.b[8] = u.b[11] = color[2]; - switch (((intptr_t)dp) & 3) - { - case 3: - *dp++ = color[0]; - *(uint32_t *)dp = u.w[1]; - dp += 4; - *(uint32_t *)dp = u.w[2]; - dp += 4; - w -= 3; - break; - case 2: - *dp++ = color[0]; - *dp++ = color[1]; - *(uint32_t *)dp = u.w[2]; - dp += 4; - w -= 2; - break; - case 1: - *dp++ = color[0]; - *dp++ = color[1]; - *dp++ = color[2]; - w -= 1; - break; - } + switch (((intptr_t)dp) & 3) + { + case 3: + *dp++ = color[0]; + *(uint32_t *)dp = u.w[1]; + dp += 4; + *(uint32_t *)dp = u.w[2]; + dp += 4; + w -= 3; + break; + case 2: + *dp++ = color[0]; + *dp++ = color[1]; + *(uint32_t *)dp = u.w[2]; + dp += 4; + w -= 2; + break; + case 1: + *dp++ = color[0]; + *dp++ = color[1]; + *dp++ = color[2]; + w -= 1; + break; + } + w -= 4; + do + { + *(uint32_t *)dp = u.w[0]; + dp += 4; + *(uint32_t *)dp = u.w[1]; + dp += 4; + *(uint32_t *)dp = u.w[2]; + dp += 4; w -= 4; - do - { - *(uint32_t *)dp = u.w[0]; - dp += 4; - *(uint32_t *)dp = u.w[1]; - dp += 4; - *(uint32_t *)dp = u.w[2]; - dp += 4; - w -= 4; - } - while (w > 0); - w += 4; - if (w == 0) - return; } + while (w > 0); + w += 4; + if (w == 0) + return; + } + do + { + dp[0] = color[0]; + if (n1 > 1) + dp[1] = color[1]; + if (n1 > 2) + dp[2] = color[2]; + for (k = 3; k < n1; k++) + dp[k] = color[k]; + if (da) + dp[n1] = 255; + dp += n; + } + while (--w); +} + +static inline void +template_solid_color_N_sa(byte * restrict dp, int n, int w, const byte * restrict color, int da, int sa) +{ + int k; + int n1 = n - da; + do + { + for (k = 0; k < n1; k++) + dp[k] = FZ_BLEND(color[k], dp[k], sa); + if (da) + dp[k] = FZ_BLEND(255, dp[k], sa); + dp += n; + } + while (--w); +} + +static inline void +template_solid_color_N_general(byte * restrict dp, int n, int w, const byte * restrict color, int da, int sa) +{ + int k; + int n1 = n - da; + if (sa == 256) + { do { dp[0] = color[0]; @@ -323,70 +356,139 @@ fz_paint_solid_color_N_general(byte * restrict dp, int n, int w, const byte * re } } -static void fz_paint_solid_color_N_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) +#if FZ_PLOTTERS_G +static void paint_solid_color_1_alpha(byte * restrict dp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_solid_color_N_sa(dp, 1, w, color, 0, FZ_EXPAND(color[1])); +} + +static void paint_solid_color_1(byte * restrict dp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_solid_color_N_256(dp, 1, w, color, 0); +} + +static void paint_solid_color_1_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_solid_color_1_da(dp, 2, w, color, 1); +} +#endif /* FZ_PLOTTERS_G */ + +#if FZ_PLOTTERS_RGB +static void paint_solid_color_3_alpha(byte * restrict dp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_solid_color_N_sa(dp, 3, w, color, 0, FZ_EXPAND(color[3])); +} + +static void paint_solid_color_3(byte * restrict dp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_solid_color_N_256(dp, 3, w, color, 0); +} + +static void paint_solid_color_3_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_solid_color_3_da(dp, 4, w, color, 1); +} +#endif /* FZ_PLOTTERS_RGB */ + +#if FZ_PLOTTERS_CMYK +static void paint_solid_color_4_alpha(byte * restrict dp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_solid_color_N_general(dp, 1, w, color, 1); + template_solid_color_N_sa(dp, 4, w, color, 0, FZ_EXPAND(color[4])); } -static void fz_paint_solid_color_1(byte * restrict dp, int n, int w, const byte * restrict color, int da) +static void paint_solid_color_4(byte * restrict dp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_solid_color_N_general(dp, 1, w, color, 0); + template_solid_color_N_256(dp, 4, w, color, 0); } -static void fz_paint_solid_color_3(byte * restrict dp, int n, int w, const byte * restrict color, int da) +static void paint_solid_color_4_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_solid_color_N_general(dp, 3, w, color, 0); + template_solid_color_4_da(dp, 5, w, color, 1); } +#endif /* FZ_PLOTTERS_CMYK */ -static void fz_paint_solid_color_4(byte * restrict dp, int n, int w, const byte * restrict color, int da) +#if FZ_PLOTTERS_N +static void paint_solid_color_N_alpha(byte * restrict dp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_solid_color_N_general(dp, 4, w, color, 0); + template_solid_color_N_sa(dp, n, w, color, 0, FZ_EXPAND(color[n])); } -static void fz_paint_solid_color_N(byte * restrict dp, int n, int w, const byte * restrict color, int da) +static void paint_solid_color_N(byte * restrict dp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_solid_color_N_general(dp, n, w, color, 0); + template_solid_color_N_256(dp, n, w, color, 0); } +static void paint_solid_color_N_da(byte * restrict dp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_solid_color_N_general(dp, n, w, color, 1, FZ_EXPAND(color[1])); +} +#endif /* FZ_PLOTTERS_N */ + fz_solid_color_painter_t * fz_get_solid_color_painter(int n, const byte * restrict color, int da) { - if (da) - { - switch (n) - { - case 2: return fz_paint_solid_color_2_da; - case 4: return fz_paint_solid_color_4_da; - case 5: return fz_paint_solid_color_5_da; - default: return fz_paint_solid_color_N_da; - } - } - else + switch (n-da) { - switch (n) - { - case 1: return fz_paint_solid_color_1; - case 3: return fz_paint_solid_color_3; - case 4: return fz_paint_solid_color_4; - default: return fz_paint_solid_color_N; - } +#if FZ_PLOTTERS_G + case 1: + if (da) + return paint_solid_color_1_da; + else if (color[1] == 255) + return paint_solid_color_1; + else + return paint_solid_color_1_alpha; +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB + case 3: + if (da) + return paint_solid_color_3_da; + else if (color[3] == 255) + return paint_solid_color_3; + else + return paint_solid_color_3_alpha; +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: + if (da) + return paint_solid_color_4_da; + else if (color[4] == 255) + return paint_solid_color_4; + else + return paint_solid_color_4_alpha; +#endif /* FZ_PLOTTERS_CMYK */ + default: +#if FZ_PLOTTERS_N + if (da) + return paint_solid_color_N_da; + else if (color[n] == 255) + return paint_solid_color_N; + else + return paint_solid_color_N_alpha; +#else + return NULL; +#endif /* FZ_PLOTTERS_N */ } - return NULL; } /* Blend a non-premultiplied color in mask over destination */ -static void -fz_paint_span_with_color_2_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +static inline void +template_span_with_color_1_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { int sa = FZ_EXPAND(color[1]); int g = color[0]; - TRACK_FN(); if (sa == 256) { do @@ -431,13 +533,12 @@ fz_paint_span_with_color_2_da(byte * restrict dp, const byte * restrict mp, int } } -static void -fz_paint_span_with_color_4_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +static inline void +template_span_with_color_3_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { unsigned int rgba = *((const unsigned int *)color); unsigned int mask, rb, ga; int sa = FZ_EXPAND(color[3]); - TRACK_FN(); if (sa == 0) return; if (isbigendian()) @@ -498,8 +599,8 @@ fz_paint_span_with_color_4_da(byte * restrict dp, const byte * restrict mp, int } } -static void -fz_paint_span_with_color_5_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +static inline void +template_span_with_color_4_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { int sa = FZ_EXPAND(color[4]); int c = color[0]; @@ -561,7 +662,7 @@ fz_paint_span_with_color_5_da(byte * restrict dp, const byte * restrict mp, int } static inline void -fz_paint_span_with_color_N_general(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +template_span_with_color_N_general(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { int k; int n1 = n - da; @@ -618,71 +719,100 @@ fz_paint_span_with_color_N_general(byte * restrict dp, const byte * restrict mp, } static void -fz_paint_span_with_color_N_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +paint_span_with_color_0_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_span_with_color_N_general(dp, mp, 1, w, color, 1); +} + +static void +paint_span_with_color_1(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_span_with_color_N_general(dp, mp, n, w, color, 1); + template_span_with_color_N_general(dp, mp, 1, w, color, 0); } static void -fz_paint_span_with_color_1(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +paint_span_with_color_1_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_span_with_color_N_general(dp, mp, 1, w, color, 0); + template_span_with_color_1_da(dp, mp, 2, w, color, 1); } +#if FZ_PLOTTERS_RGB static void -fz_paint_span_with_color_3(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +paint_span_with_color_3(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_span_with_color_N_general(dp, mp, 3, w, color, 0); + template_span_with_color_N_general(dp, mp, 3, w, color, 0); } static void -fz_paint_span_with_color_4(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +paint_span_with_color_3_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_span_with_color_N_general(dp, mp, 4, w, color, 0); + template_span_with_color_3_da(dp, mp, 4, w, color, 1); } +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK static void -fz_paint_span_with_color_N(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +paint_span_with_color_4(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) { TRACK_FN(); - fz_paint_span_with_color_N_general(dp, mp, n, w, color, 0); + template_span_with_color_N_general(dp, mp, 4, w, color, 0); } +static void +paint_span_with_color_4_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_span_with_color_4_da(dp, mp, 5, w, color, 1); +} +#endif /* FZ_PLOTTERS_CMYK */ + +#if FZ_PLOTTERS_N +static void +paint_span_with_color_N(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_span_with_color_N_general(dp, mp, n, w, color, 0); +} + +static void +paint_span_with_color_N_da(byte * restrict dp, const byte * restrict mp, int n, int w, const byte * restrict color, int da) +{ + TRACK_FN(); + template_span_with_color_N_general(dp, mp, n, w, color, 1); +} +#endif /* FZ_PLOTTERS_N */ + fz_span_color_painter_t * fz_get_span_color_painter(int n, int da, const byte * restrict color) { - if (da) - { - switch (n) - { - case 2: return fz_paint_span_with_color_2_da; - case 4: return fz_paint_span_with_color_4_da; - case 5: return fz_paint_span_with_color_5_da; - default: return fz_paint_span_with_color_N_da; - } - } - else + switch(n-da) { - switch (n) - { - case 1: return fz_paint_span_with_color_1; - case 3: return fz_paint_span_with_color_3; - case 4: return fz_paint_span_with_color_4; - default: return fz_paint_span_with_color_N; - } + case 0: return da ? paint_span_with_color_0_da : NULL; + case 1: return da ? paint_span_with_color_1_da : paint_span_with_color_1; +#if FZ_PLOTTERS_RGB + case 3: return da ? paint_span_with_color_3_da : paint_span_with_color_3; +#endif/* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: return da ? paint_span_with_color_4_da : paint_span_with_color_4; +#endif/* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N + default: return da ? paint_span_with_color_N_da : paint_span_with_color_N; +#else + default: return NULL; +#endif /* FZ_PLOTTERS_N */ } - return NULL; } /* Blend source in mask over destination */ /* FIXME: There is potential for SWAR optimisation here */ static inline void -fz_paint_span_with_mask_1_general(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int w) +template_span_with_mask_1_general(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int w) { do { @@ -750,7 +880,7 @@ fz_paint_span_with_mask_1_general(byte * restrict dp, int da, const byte * restr /* FIXME: There is potential for SWAR optimisation here */ static inline void -fz_paint_span_with_mask_3_general(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int w) +template_span_with_mask_3_general(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int w) { do { @@ -843,7 +973,7 @@ fz_paint_span_with_mask_3_general(byte * restrict dp, int da, const byte * restr /* FIXME: There is potential for SWAR optimisation here */ static inline void -fz_paint_span_with_mask_4_general(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int w) +template_span_with_mask_4_general(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int w) { do { @@ -933,7 +1063,7 @@ fz_paint_span_with_mask_4_general(byte * restrict dp, int da, const byte * restr } static inline void -fz_paint_span_with_mask_N_general(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +template_span_with_mask_N_general(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { do { @@ -1016,175 +1146,220 @@ fz_paint_span_with_mask_N_general(byte * restrict dp, int da, const byte * restr } static void -fz_paint_span_with_mask_1_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_0_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +{ + TRACK_FN(); + template_span_with_mask_N_general(dp, 1, sp, 1, mp, 0, w); +} + +static void +paint_span_with_mask_0_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_1_general(dp, 1, sp, 1, mp, w); + template_span_with_mask_N_general(dp, 1, sp, 0, mp, 0, w); } static void -fz_paint_span_with_mask_3_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_1_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_3_general(dp, 1, sp, 1, mp, w); + template_span_with_mask_1_general(dp, 1, sp, 1, mp, w); } static void -fz_paint_span_with_mask_4_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_1(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_4_general(dp, 1, sp, 1, mp, w); + template_span_with_mask_1_general(dp, 0, sp, 0, mp, w); } +#if FZ_PLOTTERS_G static void -fz_paint_span_with_mask_N_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_1_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_N_general(dp, 1, sp, 1, mp, n, w); + template_span_with_mask_1_general(dp, 1, sp, 0, mp, w); } static void -fz_paint_span_with_mask_1_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_1_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_1_general(dp, 1, sp, 0, mp, w); + template_span_with_mask_1_general(dp, 0, sp, 1, mp, w); } +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB static void -fz_paint_span_with_mask_3_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_3_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_3_general(dp, 1, sp, 0, mp, w); + template_span_with_mask_3_general(dp, 1, sp, 1, mp, w); } static void -fz_paint_span_with_mask_4_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_3_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_4_general(dp, 1, sp, 0, mp, w); + template_span_with_mask_3_general(dp, 1, sp, 0, mp, w); } static void -fz_paint_span_with_mask_N_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_3_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_N_general(dp, 1, sp, 0, mp, n, w); + template_span_with_mask_3_general(dp, 0, sp, 1, mp, w); } static void -fz_paint_span_with_mask_1_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_3(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_1_general(dp, 0, sp, 1, mp, w); + template_span_with_mask_3_general(dp, 0, sp, 0, mp, w); } +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK static void -fz_paint_span_with_mask_3_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_4_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_3_general(dp, 0, sp, 1, mp, w); + template_span_with_mask_4_general(dp, 1, sp, 1, mp, w); } static void -fz_paint_span_with_mask_4_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_4_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_4_general(dp, 0, sp, 1, mp, w); + template_span_with_mask_4_general(dp, 1, sp, 0, mp, w); } static void -fz_paint_span_with_mask_N_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_4_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_N_general(dp, 0, sp, 1, mp, n, w); + template_span_with_mask_4_general(dp, 0, sp, 1, mp, w); } static void -fz_paint_span_with_mask_1(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_4(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_1_general(dp, 0, sp, 0, mp, w); + template_span_with_mask_4_general(dp, 0, sp, 0, mp, w); } +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N static void -fz_paint_span_with_mask_3(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_N_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_3_general(dp, 0, sp, 0, mp, w); + template_span_with_mask_N_general(dp, 1, sp, 1, mp, n, w); } static void -fz_paint_span_with_mask_4(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_N_da(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_4_general(dp, 0, sp, 0, mp, w); + template_span_with_mask_N_general(dp, 1, sp, 0, mp, n, w); } static void -fz_paint_span_with_mask_N(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +paint_span_with_mask_N_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) { TRACK_FN(); - fz_paint_span_with_mask_N_general(dp, 0, sp, 0, mp, n, w); + template_span_with_mask_N_general(dp, 0, sp, 1, mp, n, w); } +static void +paint_span_with_mask_N(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w) +{ + TRACK_FN(); + template_span_with_mask_N_general(dp, 0, sp, 0, mp, n, w); +} +#endif /* FZ_PLOTTERS_N */ + typedef void (fz_span_mask_painter_t)(byte * restrict dp, int da, const byte * restrict sp, int sa, const byte * restrict mp, int n, int w); static fz_span_mask_painter_t * fz_get_span_mask_painter(int da, int sa, int n) { - if (da) - { - if (sa) - { - switch (n) - { - case 1: return fz_paint_span_with_mask_1_da_sa; - case 3: return fz_paint_span_with_mask_3_da_sa; - case 4: return fz_paint_span_with_mask_4_da_sa; - default: return fz_paint_span_with_mask_N_da_sa; - } - } - else - { - switch (n) - { - case 1: return fz_paint_span_with_mask_1_da; - case 3: return fz_paint_span_with_mask_3_da; - case 4: return fz_paint_span_with_mask_4_da; - default: return fz_paint_span_with_mask_N_da; - } - } - } - else + switch(n) { - if (sa) - { - switch (n) - { - case 1: return fz_paint_span_with_mask_1_sa; - case 3: return fz_paint_span_with_mask_3_sa; - case 4: return fz_paint_span_with_mask_4_sa; - default: return fz_paint_span_with_mask_N_sa; - } - } - else - { - switch (n) - { - case 1: return fz_paint_span_with_mask_1; - case 3: return fz_paint_span_with_mask_3; - case 4: return fz_paint_span_with_mask_4; - default: return fz_paint_span_with_mask_N; - } - } + case 0: + if (!da) + return NULL; + if (sa) + return paint_span_with_mask_0_da_sa; + else + return paint_span_with_mask_0_da; + case 1: +#if FZ_PLOTTERS_G + if (da) + if (sa) + return paint_span_with_mask_1_da_sa; + else + return paint_span_with_mask_1_da; + else + if (sa) + return paint_span_with_mask_1_sa; + else + return paint_span_with_mask_1; +#else + if (da && sa) + return paint_span_with_mask_1_da_sa; + if (!da & !sa) + return paint_span_with_mask_1; + return NULL; +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB + case 3: + if (da) + if (sa) + return paint_span_with_mask_3_da_sa; + else + return paint_span_with_mask_3_da; + else + if (sa) + return paint_span_with_mask_3_sa; + else + return paint_span_with_mask_3; +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: + if (da) + if (sa) + return paint_span_with_mask_4_da_sa; + else + return paint_span_with_mask_4_da; + else + if (sa) + return paint_span_with_mask_4_sa; + else + return paint_span_with_mask_4; +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N + default: + if (da) + if (sa) + return paint_span_with_mask_N_da_sa; + else + return paint_span_with_mask_N_da; + else + if (sa) + return paint_span_with_mask_N_sa; + else + return paint_span_with_mask_N; +#else + default: return NULL; +#endif /* FZ_PLOTTERS_N */ } - return NULL; } /* Blend source in constant alpha over destination */ static inline void -fz_paint_span_1_with_alpha_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w, int alpha) +template_span_1_with_alpha_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w, int alpha) { if (sa) alpha = FZ_EXPAND(alpha); @@ -1205,7 +1380,7 @@ fz_paint_span_1_with_alpha_general(byte * restrict dp, int da, const byte * rest } static inline void -fz_paint_span_3_with_alpha_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w, int alpha) +template_span_3_with_alpha_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w, int alpha) { if (sa) alpha = FZ_EXPAND(alpha); @@ -1230,7 +1405,7 @@ fz_paint_span_3_with_alpha_general(byte * restrict dp, int da, const byte * rest } static inline void -fz_paint_span_4_with_alpha_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w, int alpha) +template_span_4_with_alpha_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w, int alpha) { if (sa) alpha = FZ_EXPAND(alpha); @@ -1257,7 +1432,7 @@ fz_paint_span_4_with_alpha_general(byte * restrict dp, int da, const byte * rest } static inline void -fz_paint_span_N_with_alpha_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int n1, int w, int alpha) +template_span_N_with_alpha_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int n1, int w, int alpha) { if (sa) alpha = FZ_EXPAND(alpha); @@ -1284,7 +1459,7 @@ fz_paint_span_N_with_alpha_general(byte * restrict dp, int da, const byte * rest /* Blend source over destination */ static inline void -fz_paint_span_1_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w) +template_span_1_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w) { do { @@ -1322,7 +1497,7 @@ fz_paint_span_1_general(byte * restrict dp, int da, const byte * restrict sp, in } static inline void -fz_paint_span_3_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w) +template_span_3_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w) { do { @@ -1370,7 +1545,7 @@ fz_paint_span_3_general(byte * restrict dp, int da, const byte * restrict sp, in } static inline void -fz_paint_span_4_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w) +template_span_4_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int w) { do { @@ -1416,7 +1591,7 @@ fz_paint_span_4_general(byte * restrict dp, int da, const byte * restrict sp, in } static inline void -fz_paint_span_N_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int n1, int w) +template_span_N_general(byte * restrict dp, int da, const byte * restrict sp, int sa, int n1, int w) { do { @@ -1462,342 +1637,415 @@ fz_paint_span_N_general(byte * restrict dp, int da, const byte * restrict sp, in } static void -fz_paint_span_0_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_0_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { + TRACK_FN(); do { - int t = FZ_EXPAND(255 - sp[0]); - *dp = *sp++ + FZ_COMBINE(*dp, t); + int s = *sp++; + int t = FZ_EXPAND(255 - s); + *dp = s + FZ_COMBINE(*dp, t); dp ++; } while (--w); } static void -fz_paint_span_1_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_0_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_1_general(dp, 1, sp, 1, w); + alpha = FZ_EXPAND(alpha); + do + { + int masa = FZ_COMBINE(sp[0], alpha); + *dp = FZ_BLEND(*sp, *dp, masa); + dp++; + sp++; + } + while (--w); +} + +static void +paint_span_1_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +{ + TRACK_FN(); + template_span_1_general(dp, 0, sp, 1, w); } static void -fz_paint_span_3_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_1_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_3_general(dp, 1, sp, 1, w); + template_span_1_with_alpha_general(dp, 0, sp, 1, w, alpha); } static void -fz_paint_span_4_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_1_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_4_general(dp, 1, sp, 1, w); + template_span_1_general(dp, 1, sp, 1, w); } static void -fz_paint_span_N_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_1_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_N_general(dp, 1, sp, 1, n, w); + template_span_1_with_alpha_general(dp, 1, sp, 1, w, alpha); } +#if FZ_PLOTTERS_G static void -fz_paint_span_1_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_1_da(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_1_with_alpha_general(dp, 1, sp, 1, w, alpha); + template_span_1_general(dp, 1, sp, 0, w); } static void -fz_paint_span_3_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_1_da_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_3_with_alpha_general(dp, 1, sp, 1, w, alpha); + template_span_1_with_alpha_general(dp, 1, sp, 0, w, alpha); } static void -fz_paint_span_4_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_1(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_4_with_alpha_general(dp, 1, sp, 1, w, alpha); + template_span_1_general(dp, 0, sp, 0, w); } static void -fz_paint_span_N_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_1_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_N_with_alpha_general(dp, 1, sp, 1, n, w, alpha); + template_span_1_with_alpha_general(dp, 0, sp, 0, w, alpha); } +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB static void -fz_paint_span_1_da(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_3_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_1_general(dp, 1, sp, 0, w); + template_span_3_general(dp, 1, sp, 1, w); } static void -fz_paint_span_3_da(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_3_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_3_general(dp, 1, sp, 0, w); + template_span_3_with_alpha_general(dp, 1, sp, 1, w, alpha); } static void -fz_paint_span_4_da(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_3_da(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_4_general(dp, 1, sp, 0, w); + template_span_3_general(dp, 1, sp, 0, w); } static void -fz_paint_span_N_da(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_3_da_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_N_general(dp, 1, sp, 0, n, w); + template_span_3_with_alpha_general(dp, 1, sp, 0, w, alpha); } static void -fz_paint_span_1_da_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_3_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_1_with_alpha_general(dp, 1, sp, 0, w, alpha); + template_span_3_general(dp, 0, sp, 1, w); } static void -fz_paint_span_3_da_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_3_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_3_with_alpha_general(dp, 1, sp, 0, w, alpha); + template_span_3_with_alpha_general(dp, 0, sp, 1, w, alpha); } static void -fz_paint_span_4_da_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_3(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_4_with_alpha_general(dp, 1, sp, 0, w, alpha); + template_span_3_general(dp, 0, sp, 0, w); } static void -fz_paint_span_N_da_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_3_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_N_with_alpha_general(dp, 1, sp, 0, n, w, alpha); + template_span_3_with_alpha_general(dp, 0, sp, 0, w, alpha); } +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK static void -fz_paint_span_1_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_4_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_1_general(dp, 0, sp, 1, w); + template_span_4_general(dp, 1, sp, 1, w); } static void -fz_paint_span_3_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_4_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_3_general(dp, 0, sp, 1, w); + template_span_4_with_alpha_general(dp, 1, sp, 1, w, alpha); } static void -fz_paint_span_4_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_4_da(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_4_general(dp, 0, sp, 1, w); + template_span_4_general(dp, 1, sp, 0, w); } static void -fz_paint_span_N_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_4_da_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_N_general(dp, 0, sp, 1, n, w); + template_span_4_with_alpha_general(dp, 1, sp, 0, w, alpha); } static void -fz_paint_span_1_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_4_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_1_with_alpha_general(dp, 0, sp, 1, w, alpha); + template_span_4_general(dp, 0, sp, 1, w); } static void -fz_paint_span_3_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_4_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_3_with_alpha_general(dp, 0, sp, 1, w, alpha); + template_span_4_with_alpha_general(dp, 0, sp, 1, w, alpha); } static void -fz_paint_span_4_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_4(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_4_with_alpha_general(dp, 0, sp, 1, w, alpha); + template_span_4_general(dp, 0, sp, 0, w); } static void -fz_paint_span_N_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_4_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_N_with_alpha_general(dp, 0, sp, 1, n, w, alpha); + template_span_4_with_alpha_general(dp, 0, sp, 0, w, alpha); } +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N static void -fz_paint_span_1(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_N_da_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_1_general(dp, 0, sp, 0, w); + template_span_N_general(dp, 1, sp, 1, n, w); } static void -fz_paint_span_3(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_N_da_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_3_general(dp, 0, sp, 0, w); + template_span_N_with_alpha_general(dp, 1, sp, 1, n, w, alpha); } static void -fz_paint_span_4(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_N_da(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_4_general(dp, 0, sp, 0, w); + template_span_N_general(dp, 1, sp, 0, n, w); } static void -fz_paint_span_N(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_N_da_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_N_general(dp, 0, sp, 0, n, w); + template_span_N_with_alpha_general(dp, 1, sp, 0, n, w, alpha); } static void -fz_paint_span_1_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_N_sa(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_1_with_alpha_general(dp, 0, sp, 0, w, alpha); + template_span_N_general(dp, 0, sp, 1, n, w); } static void -fz_paint_span_3_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_N_sa_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_3_with_alpha_general(dp, 0, sp, 0, w, alpha); + template_span_N_with_alpha_general(dp, 0, sp, 1, n, w, alpha); } static void -fz_paint_span_4_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_N(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_4_with_alpha_general(dp, 0, sp, 0, w, alpha); + template_span_N_general(dp, 0, sp, 0, n, w); } static void -fz_paint_span_N_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) +paint_span_N_alpha(byte * restrict dp, int da, const byte * restrict sp, int sa, int n, int w, int alpha) { TRACK_FN(); - fz_paint_span_N_with_alpha_general(dp, 0, sp, 0, n, w, alpha); + template_span_N_with_alpha_general(dp, 0, sp, 0, n, w, alpha); } +#endif /* FZ_PLOTTERS_N */ fz_span_painter_t * fz_get_span_painter(int da, int sa, int n, int alpha) { - if (da) + switch (n) { + case 0: + if (alpha == 255) + return paint_span_0_da_sa; + else if (alpha > 0) + return paint_span_0_da_sa_alpha; + break; + case 1: if (sa) - { - if (alpha == 255) + if (da) { - switch (n) - { - case 0: return fz_paint_span_0_da_sa; - case 1: return fz_paint_span_1_da_sa; - case 3: return fz_paint_span_3_da_sa; - case 4: return fz_paint_span_4_da_sa; - default: return fz_paint_span_N_da_sa; - } + if (alpha == 255) + return paint_span_1_da_sa; + else if (alpha > 0) + return paint_span_1_da_sa_alpha; } - else if (alpha > 0) + else { - switch (n) - { - case 1: return fz_paint_span_1_da_sa_alpha; - case 3: return fz_paint_span_3_da_sa_alpha; - case 4: return fz_paint_span_4_da_sa_alpha; - default: return fz_paint_span_N_da_sa_alpha; - } + if (alpha == 255) + return paint_span_1_sa; + else if (alpha > 0) + return paint_span_1_sa_alpha; } - } else - { - if (alpha == 255) +#if FZ_PLOTTERS_G + if (da) { - switch (n) - { - case 1: return fz_paint_span_1_da; - case 3: return fz_paint_span_3_da; - case 4: return fz_paint_span_4_da; - default: return fz_paint_span_N_da; - } + if (alpha == 255) + return paint_span_1_da; + else if (alpha > 0) + return paint_span_1_da_alpha; } - else if (alpha > 0) + else { - switch (n) - { - case 1: return fz_paint_span_1_da_alpha; - case 3: return fz_paint_span_3_da_alpha; - case 4: return fz_paint_span_4_da_alpha; - default: return fz_paint_span_N_da_alpha; - } + if (alpha == 255) + return paint_span_1; + else if (alpha > 0) + return paint_span_1_alpha; } - } - } - else - { - if (sa) - { - if (alpha == 255) +#else + return NULL; +#endif /* FZ_PLOTTERS_G */ + break; +#if FZ_PLOTTERS_RGB + case 3: + if (da) + if (sa) { - switch (n) - { - case 1: return fz_paint_span_1_sa; - case 3: return fz_paint_span_3_sa; - case 4: return fz_paint_span_4_sa; - default: return fz_paint_span_N_sa; - } + if (alpha == 255) + return paint_span_3_da_sa; + else if (alpha > 0) + return paint_span_3_da_sa_alpha; } - else if (alpha > 0) + else { - switch (n) - { - case 1: return fz_paint_span_1_sa_alpha; - case 3: return fz_paint_span_3_sa_alpha; - case 4: return fz_paint_span_4_sa_alpha; - default: return fz_paint_span_N_sa_alpha; - } + if (alpha == 255) + return paint_span_3_da; + else if (alpha > 0) + return paint_span_3_da_alpha; } - } else - { - if (alpha == 255) + if (sa) { - switch (n) - { - case 1: return fz_paint_span_1; - case 3: return fz_paint_span_3; - case 4: return fz_paint_span_4; - default: return fz_paint_span_N; - } + if (alpha == 255) + return paint_span_3_sa; + else if (alpha > 0) + return paint_span_3_sa_alpha; } - else if (alpha > 0) + else { - switch (n) - { - case 1: return fz_paint_span_1_alpha; - case 3: return fz_paint_span_3_alpha; - case 4: return fz_paint_span_4_alpha; - default: return fz_paint_span_N_alpha; - } + if (alpha == 255) + return paint_span_3; + else if (alpha > 0) + return paint_span_3_alpha; } - } + break; +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: + if (da) + if (sa) + { + if (alpha == 255) + return paint_span_4_da_sa; + else if (alpha > 0) + return paint_span_4_da_sa_alpha; + } + else + { + if (alpha == 255) + return paint_span_4_da; + else if (alpha > 0) + return paint_span_4_da_alpha; + } + else + if (sa) + { + if (alpha == 255) + return paint_span_4_sa; + else if (alpha > 0) + return paint_span_4_sa_alpha; + } + else + { + if (alpha == 255) + return paint_span_4; + else if (alpha > 0) + return paint_span_4_alpha; + } + break; +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N + default: + if (da) + if (sa) + { + if (alpha == 255) + return paint_span_N_da_sa; + else if (alpha > 0) + return paint_span_N_da_sa_alpha; + } + else + { + if (alpha == 255) + return paint_span_N_da; + else if (alpha > 0) + return paint_span_N_da_alpha; + } + else + if (sa) + { + if (alpha == 255) + return paint_span_N_sa; + else if (alpha > 0) + return paint_span_N_sa_alpha; + } + else + { + if (alpha == 255) + return paint_span_N; + else if (alpha > 0) + return paint_span_N_alpha; + } + break; +#endif /* FZ_PLOTTERS_N */ } return NULL; } @@ -1837,6 +2085,7 @@ fz_paint_pixmap_with_bbox(fz_pixmap * restrict dst, const fz_pixmap * restrict s n -= sa; fn = fz_get_span_painter(da, sa, n, alpha); + assert(fn); if (fn == NULL) return; @@ -1879,6 +2128,7 @@ fz_paint_pixmap(fz_pixmap * restrict dst, const fz_pixmap * restrict src, int al n -= sa; fn = fz_get_span_painter(da, sa, n, alpha); + assert(fn); if (fn == NULL) return; @@ -2065,161 +2315,161 @@ intermediate_run: } } -#define DA #define N 1 #include "paint-glyph.h" -#define DA -#define N 3 -#include "paint-glyph.h" - -#define DA -#define N 4 +#define ALPHA +#define N 1 #include "paint-glyph.h" +#if FZ_PLOTTERS_G #define DA +#define N 1 #include "paint-glyph.h" #define DA #define ALPHA #define N 1 #include "paint-glyph.h" +#endif /* FZ_PLOTTERS_G */ +#if FZ_PLOTTERS_RGB #define DA -#define ALPHA #define N 3 #include "paint-glyph.h" #define DA #define ALPHA -#define N 4 +#define N 3 +#include "paint-glyph.h" + +#define N 3 #include "paint-glyph.h" -#define DA #define ALPHA +#define N 3 #include "paint-glyph.h" +#endif /* FZ_PLOTTERS_RGB */ -#define N 1 +#if FZ_PLOTTERS_CMYK +#define DA +#define N 4 #include "paint-glyph.h" -#define N 3 +#define DA +#define ALPHA +#define N 4 #include "paint-glyph.h" +#define ALPHA #define N 4 #include "paint-glyph.h" +#define N 4 #include "paint-glyph.h" +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N #define ALPHA -#define N 1 #include "paint-glyph.h" -#define ALPHA -#define N 3 +#define DA #include "paint-glyph.h" +#define DA #define ALPHA -#define N 4 #include "paint-glyph.h" -#define ALPHA #include "paint-glyph.h" +#endif /* FZ_PLOTTERS_N */ 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) { - if (da) + switch (n) { - switch (n) - { - case 1: - TRACK_LABEL("pgda1"); + case 1: + if (da) +#if FZ_PLOTTERS_G fz_paint_glyph_alpha_1_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - case 3: - TRACK_LABEL("pgda3"); - fz_paint_glyph_alpha_3_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - case 4: - TRACK_LABEL("pgda4"); - fz_paint_glyph_alpha_4_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - default: - TRACK_LABEL("pgdan"); - fz_paint_glyph_alpha_N_da(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y); - break; - } - } - else - { - switch (n) +#else { - case 1: - TRACK_LABEL("pga1"); + assert("Unexpected plotter" == NULL); + return; + } +#endif /* FZ_PLOTTERS_G */ + else fz_paint_glyph_alpha_1(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - case 3: - TRACK_LABEL("pga3"); + break; +#if FZ_PLOTTERS_RGB + case 3: + if (da) + fz_paint_glyph_alpha_3_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); + else fz_paint_glyph_alpha_3(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - case 4: - TRACK_LABEL("pga4"); + break; +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: + if (da) + fz_paint_glyph_alpha_4_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); + else fz_paint_glyph_alpha_4(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - default: - TRACK_LABEL("pgan"); + break; +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N + default: + if (da) + fz_paint_glyph_alpha_N_da(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y); + else fz_paint_glyph_alpha_N(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y); - break; - } + break; +#endif /* FZ_PLOTTERS_N */ } } 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) { - if (da) + switch (n) { - switch (n) - { - case 1: - TRACK_LABEL("pg1d1"); + case 1: + if (da) +#if FZ_PLOTTERS_G fz_paint_glyph_solid_1_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - case 3: - TRACK_LABEL("pg1d3"); - fz_paint_glyph_solid_3_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - case 4: - TRACK_LABEL("pg1d4"); - fz_paint_glyph_solid_4_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - default: - TRACK_LABEL("pg1dn"); - fz_paint_glyph_solid_N_da(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y); - break; - } - } - else - { - switch (n) +#else { - case 1: - TRACK_LABEL("pg11"); + assert("Unexpected plotter" == NULL); + return; + } +#endif /* FZ_PLOTTERS_G */ + else fz_paint_glyph_solid_1(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - case 3: - TRACK_LABEL("pg13"); + break; +#if FZ_PLOTTERS_RGB + case 3: + if (da) + fz_paint_glyph_solid_3_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); + else fz_paint_glyph_solid_3(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - case 4: - TRACK_LABEL("pg14"); + break; +#endif /* FZ_PLOTTERS_RGB */ +#if FZ_PLOTTERS_CMYK + case 4: + if (da) + fz_paint_glyph_solid_4_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y); + else fz_paint_glyph_solid_4(colorbv, span, dp, glyph, w, h, skip_x, skip_y); - break; - default: - TRACK_LABEL("pg1n"); + break; +#endif /* FZ_PLOTTERS_CMYK */ +#if FZ_PLOTTERS_N + default: + if (da) + fz_paint_glyph_solid_N_da(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y); + else fz_paint_glyph_solid_N(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y); - break; - } + break; +#endif /* FZ_PLOTTERS_N */ } } diff --git a/source/fitz/paint-glyph.h b/source/fitz/paint-glyph.h index 824adaf2..748e6b19 100644 --- a/source/fitz/paint-glyph.h +++ b/source/fitz/paint-glyph.h @@ -44,6 +44,7 @@ FUNCTION_NAME(NAME,N,NAME2)(const unsigned char * restrict colorbv, const uint32_t color = *(const uint32_t *)colorbv; #endif #endif + TRACK_FN(); while (h--) { int skip_xx, ww, len, extend; @@ -169,7 +170,7 @@ solid_run: *ddp = FZ_BLEND(colorbv[k++], *ddp, sa); ddp++; } - while (k != n); + while (k != n1); #ifdef DA *ddp = FZ_BLEND(0xFF, *ddp, sa); ddp++; -- cgit v1.2.3