summaryrefslogtreecommitdiff
path: root/source/fitz/test-device.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-01-12 17:30:59 +0000
committerRobin Watts <robin.watts@artifex.com>2016-01-13 12:32:58 +0000
commitad8936bf2bcf54c7042bdec20c49c96657649b34 (patch)
tree0d6e309f5747e493632b72b34acef1e53e1ed9d7 /source/fitz/test-device.c
parent881b7ea89588677e709aaa7d3d0ffe4aed63822a (diff)
downloadmupdf-ad8936bf2bcf54c7042bdec20c49c96657649b34.tar.xz
Add lots of consts.
In general, we should use 'const fz_blah' in device calls whenever the callee should not alter the fz_blah. Push this through. This shows up various places where we fz_keep and fz_drop these const things. I've updated the fz_keep and fz_drops with appropriate casts to remove the consts. We may need to do the union dance to avoid the consts for some compilers, but will only do that if required. I think this is nicer overall, even allowing for the const<->no const problems.
Diffstat (limited to 'source/fitz/test-device.c')
-rw-r--r--source/fitz/test-device.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c
index 86b39161..339b1e94 100644
--- a/source/fitz/test-device.c
+++ b/source/fitz/test-device.c
@@ -26,7 +26,7 @@ is_rgb_color_u8(int threshold_u8, int r, int g, int b)
}
static void
-fz_test_color(fz_context *ctx, fz_device *dev, fz_colorspace *colorspace, const float *color)
+fz_test_color(fz_context *ctx, fz_device *dev, const fz_colorspace *colorspace, const float *color)
{
fz_test_device *t = (fz_test_device*)dev;
@@ -56,32 +56,32 @@ fz_test_color(fz_context *ctx, fz_device *dev, fz_colorspace *colorspace, const
}
static void
-fz_test_fill_path(fz_context *ctx, fz_device *dev, fz_path *path, int even_odd, const fz_matrix *ctm,
- fz_colorspace *colorspace, float *color, float alpha)
+fz_test_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm,
+ const fz_colorspace *colorspace, const float *color, float alpha)
{
if (alpha != 0.0f)
fz_test_color(ctx, dev, colorspace, color);
}
static void
-fz_test_stroke_path(fz_context *ctx, fz_device *dev, fz_path *path, fz_stroke_state *stroke,
- const fz_matrix *ctm, fz_colorspace *colorspace, float *color, float alpha)
+fz_test_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke,
+ const fz_matrix *ctm, const fz_colorspace *colorspace, const float *color, float alpha)
{
if (alpha != 0.0f)
fz_test_color(ctx, dev, colorspace, color);
}
static void
-fz_test_fill_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm,
- fz_colorspace *colorspace, float *color, float alpha)
+fz_test_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm,
+ const fz_colorspace *colorspace, const float *color, float alpha)
{
if (alpha != 0.0f)
fz_test_color(ctx, dev, colorspace, color);
}
static void
-fz_test_stroke_text(fz_context *ctx, fz_device *dev, fz_text *text, fz_stroke_state *stroke,
- const fz_matrix *ctm, fz_colorspace *colorspace, float *color, float alpha)
+fz_test_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke,
+ const fz_matrix *ctm, const fz_colorspace *colorspace, const float *color, float alpha)
{
if (alpha != 0.0f)
fz_test_color(ctx, dev, colorspace, color);
@@ -90,7 +90,7 @@ fz_test_stroke_text(fz_context *ctx, fz_device *dev, fz_text *text, fz_stroke_st
struct shadearg
{
fz_device *dev;
- fz_shade *shade;
+ const fz_shade *shade;
};
static void
@@ -98,13 +98,13 @@ prepare_vertex(fz_context *ctx, void *arg_, fz_vertex *v, const float *color)
{
struct shadearg *arg = arg_;
fz_device *dev = arg->dev;
- fz_shade *shade = arg->shade;
+ const fz_shade *shade = arg->shade;
if (!shade->use_function)
fz_test_color(ctx, dev, shade->colorspace, color);
}
static void
-fz_test_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha)
+fz_test_fill_shade(fz_context *ctx, fz_device *dev, const fz_shade *shade, const fz_matrix *ctm, float alpha)
{
if (shade->use_function)
{
@@ -122,7 +122,7 @@ fz_test_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_ma
}
static void
-fz_test_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha)
+fz_test_fill_image(fz_context *ctx, fz_device *dev, const fz_image *image, const fz_matrix *ctm, float alpha)
{
fz_test_device *t = (fz_test_device*)dev;
@@ -241,8 +241,8 @@ fz_test_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma
}
static void
-fz_test_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm,
- fz_colorspace *colorspace, float *color, float alpha)
+fz_test_fill_image_mask(fz_context *ctx, fz_device *dev, const fz_image *image, const fz_matrix *ctm,
+ const fz_colorspace *colorspace, const float *color, float alpha)
{
/* We assume that at least some of the image pixels are non-zero */
fz_test_color(ctx, dev, colorspace, color);