summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-05-30 13:04:43 +0100
committerRobin Watts <robin.watts@artifex.com>2016-05-30 16:08:47 +0100
commit846a8a68df55016e5cc2e77d02f4b586b004df01 (patch)
tree93a74e1eb9335be8a1ffdf3191b2029b3c0c73e6 /source
parentba5dd08df9b477dbfa5ee9b2c5b56f41dfa8bc85 (diff)
downloadmupdf-846a8a68df55016e5cc2e77d02f4b586b004df01.tar.xz
Ensure that we can use FZ_PLOTTERS_N instead of FZ_PLOTTERS_RGB.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/draw-affine.c22
-rw-r--r--source/fitz/draw-device.c2
-rw-r--r--source/fitz/draw-paint.c48
3 files changed, 50 insertions, 22 deletions
diff --git a/source/fitz/draw-affine.c b/source/fitz/draw-affine.c
index 2738c188..db68a705 100644
--- a/source/fitz/draw-affine.c
+++ b/source/fitz/draw-affine.c
@@ -1084,7 +1084,7 @@ fz_paint_affine_lerp(int da, int sa, int fa, int fb, int n, int alpha)
return paint_affine_lerp_sa_alpha_1;
}
#else
- return NULL;
+ goto fallback;
#endif /* FZ_PLOTTERS_H */
else
if (da)
@@ -1170,8 +1170,12 @@ fz_paint_affine_lerp(int da, int sa, int fa, int fb, int n, int alpha)
}
break;
#endif /* FZ_PLOTTERS_CMYK */
-#if FZ_PLOTTERS_N
default:
+ {
+#if !FZ_PLOTTERS_G
+fallback:
+#endif /* FZ_PLOTTERS_G */
+#if FZ_PLOTTERS_N
if (da)
if (sa)
{
@@ -1202,8 +1206,9 @@ fz_paint_affine_lerp(int da, int sa, int fa, int fb, int n, int alpha)
else if (alpha > 0)
return paint_affine_lerp_alpha_N;
}
- break;
#endif /* FZ_PLOTTERS_G */
+ break;
+ }
}
return NULL;
}
@@ -2169,7 +2174,7 @@ fz_paint_affine_near(int da, int sa, int fa, int fb, int n, int alpha)
}
}
#else
- return NULL;
+ goto fallback;
#endif /* FZ_PLOTTERS_G */
else
if (da)
@@ -2395,8 +2400,12 @@ fz_paint_affine_near(int da, int sa, int fa, int fb, int n, int alpha)
}
#endif /* FZ_PLOTTERS_CMYK */
break;
-#if FZ_PLOTTERS_N
default:
+ {
+#if !FZ_PLOTTERS_G
+fallback:
+#endif /* FZ_PLOTTERS_G */
+#if FZ_PLOTTERS_N
if (da)
if (sa)
{
@@ -2486,6 +2495,7 @@ fz_paint_affine_near(int da, int sa, int fa, int fb, int n, int alpha)
#endif /* FZ_PLOTTERS_N */
break;
}
+ }
return NULL;
}
@@ -3248,6 +3258,7 @@ fz_paint_image_imp(fz_pixmap * restrict dst, const fz_irect *scissor, const fz_p
if (img->n == sa && color)
sa = 0;
+#if FZ_PLOTTERS_RGB
if (n == 3 && img->n == 1 + sa && !color)
{
if (dolerp)
@@ -3256,6 +3267,7 @@ fz_paint_image_imp(fz_pixmap * restrict dst, const fz_irect *scissor, const fz_p
paintfn = fz_paint_affine_g2rgb_near(da, sa, fa, fb, n, alpha);
}
else
+#endif /* FZ_PLOTTERS_RGB */
{
assert((!color && img->n - sa == n) || (color && img->n - sa == 1));
if (dolerp)
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 99032df9..10122b1d 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -1271,12 +1271,14 @@ fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, const fz_m
if (pixmap->colorspace != model)
{
+#if FZ_PLOTTERS_RGB
if ((pixmap->colorspace == fz_device_gray(ctx) && model == fz_device_rgb(ctx)) ||
(pixmap->colorspace == fz_device_gray(ctx) && model == fz_device_bgr(ctx)))
{
/* We have special case rendering code for gray -> rgb/bgr */
}
else
+#endif
{
fz_irect bbox;
fz_pixmap_bbox(ctx, pixmap, &bbox);
diff --git a/source/fitz/draw-paint.c b/source/fitz/draw-paint.c
index 51a84bc2..d004a289 100644
--- a/source/fitz/draw-paint.c
+++ b/source/fitz/draw-paint.c
@@ -1310,7 +1310,7 @@ fz_get_span_mask_painter(int da, int sa, int n)
return paint_span_with_mask_1_da_sa;
if (!da & !sa)
return paint_span_with_mask_1;
- return NULL;
+ goto fallback;
#endif /* FZ_PLOTTERS_G */
#if FZ_PLOTTERS_RGB
case 3:
@@ -1338,8 +1338,12 @@ fz_get_span_mask_painter(int da, int sa, int n)
else
return paint_span_with_mask_4;
#endif /* FZ_PLOTTERS_CMYK */
-#if FZ_PLOTTERS_N
default:
+ {
+#if !FZ_PLOTTERS_G
+fallback:
+#endif /* !FZ_PLOTTERS_G */
+#if FZ_PLOTTERS_N
if (da)
if (sa)
return paint_span_with_mask_N_da_sa;
@@ -1351,8 +1355,9 @@ fz_get_span_mask_painter(int da, int sa, int n)
else
return paint_span_with_mask_N;
#else
- default: return NULL;
+ return NULL;
#endif /* FZ_PLOTTERS_N */
+ }
}
}
@@ -1941,7 +1946,7 @@ fz_get_span_painter(int da, int sa, int n, int alpha)
return paint_span_1_alpha;
}
#else
- return NULL;
+ goto fallback;
#endif /* FZ_PLOTTERS_G */
break;
#if FZ_PLOTTERS_RGB
@@ -2012,8 +2017,12 @@ fz_get_span_painter(int da, int sa, int n, int alpha)
}
break;
#endif /* FZ_PLOTTERS_CMYK */
-#if FZ_PLOTTERS_N
default:
+ {
+#if !FZ_PLOTTERS_G
+fallback:
+#endif /* FZ_PLOTTERS_G */
+#if FZ_PLOTTERS_N
if (da)
if (sa)
{
@@ -2044,8 +2053,9 @@ fz_get_span_painter(int da, int sa, int n, int alpha)
else if (alpha > 0)
return paint_span_N_alpha;
}
- break;
#endif /* FZ_PLOTTERS_N */
+ break;
+ }
}
return NULL;
}
@@ -2393,10 +2403,7 @@ fz_paint_glyph_alpha(const unsigned char * restrict colorbv, int n, int span, un
#if FZ_PLOTTERS_G
fz_paint_glyph_alpha_1_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y);
#else
- {
- assert("Unexpected plotter" == NULL);
- return;
- }
+ goto fallback;
#endif /* FZ_PLOTTERS_G */
else
fz_paint_glyph_alpha_1(colorbv, span, dp, glyph, w, h, skip_x, skip_y);
@@ -2417,14 +2424,19 @@ fz_paint_glyph_alpha(const unsigned char * restrict colorbv, int n, int span, un
fz_paint_glyph_alpha_4(colorbv, span, dp, glyph, w, h, skip_x, skip_y);
break;
#endif /* FZ_PLOTTERS_CMYK */
-#if FZ_PLOTTERS_N
default:
+ {
+#if !FZ_PLOTTERS_G
+fallback:
+#endif /* !FZ_PLOTTERS_G */
+#if FZ_PLOTTERS_N
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;
#endif /* FZ_PLOTTERS_N */
+ break;
+ }
}
}
@@ -2438,10 +2450,7 @@ fz_paint_glyph_solid(const unsigned char * restrict colorbv, int n, int span, un
#if FZ_PLOTTERS_G
fz_paint_glyph_solid_1_da(colorbv, span, dp, glyph, w, h, skip_x, skip_y);
#else
- {
- assert("Unexpected plotter" == NULL);
- return;
- }
+ goto fallback;
#endif /* FZ_PLOTTERS_G */
else
fz_paint_glyph_solid_1(colorbv, span, dp, glyph, w, h, skip_x, skip_y);
@@ -2462,8 +2471,12 @@ fz_paint_glyph_solid(const unsigned char * restrict colorbv, int n, int span, un
fz_paint_glyph_solid_4(colorbv, span, dp, glyph, w, h, skip_x, skip_y);
break;
#endif /* FZ_PLOTTERS_CMYK */
-#if FZ_PLOTTERS_N
default:
+ {
+#if !FZ_PLOTTERS_G
+fallback:
+#endif /* FZ_PLOTTERS_G */
+#if FZ_PLOTTERS_N
if (da)
fz_paint_glyph_solid_N_da(colorbv, n, span, dp, glyph, w, h, skip_x, skip_y);
else
@@ -2471,6 +2484,7 @@ fz_paint_glyph_solid(const unsigned char * restrict colorbv, int n, int span, un
break;
#endif /* FZ_PLOTTERS_N */
}
+ }
}
void