summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-02-22 14:18:05 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-02-22 14:30:36 +0100
commitad8a5680e6d3fd1ad77ae2c1a3d38ebe2042f2cb (patch)
treed7da3d8e161086470a3e3238fe7ac650eb8e44a4 /source/fitz
parent35a0cb70629c57eb94cb99fec83f994d3d496a7b (diff)
downloadmupdf-ad8a5680e6d3fd1ad77ae2c1a3d38ebe2042f2cb.tar.xz
Drop const from fz_shade.
Shading objects are immutable and opaque once constructed. Therefore there is no need for the const keyword.
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/bbox-device.c2
-rw-r--r--source/fitz/device.c2
-rw-r--r--source/fitz/draw-device.c2
-rw-r--r--source/fitz/draw-mesh.c2
-rw-r--r--source/fitz/list-device.c2
-rw-r--r--source/fitz/shade.c40
-rw-r--r--source/fitz/svg-device.c2
-rw-r--r--source/fitz/test-device.c6
-rw-r--r--source/fitz/trace-device.c2
9 files changed, 28 insertions, 32 deletions
diff --git a/source/fitz/bbox-device.c b/source/fitz/bbox-device.c
index 83be00c8..960bf0eb 100644
--- a/source/fitz/bbox-device.c
+++ b/source/fitz/bbox-device.c
@@ -66,7 +66,7 @@ fz_bbox_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const
}
static void
-fz_bbox_fill_shade(fz_context *ctx, fz_device *dev, const fz_shade *shade, const fz_matrix *ctm, float alpha)
+fz_bbox_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha)
{
fz_rect r;
fz_bbox_add_rect(ctx, dev, fz_bound_shade(ctx, shade, ctm, &r), 0);
diff --git a/source/fitz/device.c b/source/fitz/device.c
index 8913cdb2..ae5b9f24 100644
--- a/source/fitz/device.c
+++ b/source/fitz/device.c
@@ -261,7 +261,7 @@ fz_pop_clip(fz_context *ctx, fz_device *dev)
}
void
-fz_fill_shade(fz_context *ctx, fz_device *dev, const fz_shade *shade, const fz_matrix *ctm, float alpha)
+fz_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha)
{
if (dev->error_depth)
return;
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 0617ea7b..b623a53b 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -933,7 +933,7 @@ fz_draw_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const
}
static void
-fz_draw_fill_shade(fz_context *ctx, fz_device *devp, const fz_shade *shade, const fz_matrix *ctm, float alpha)
+fz_draw_fill_shade(fz_context *ctx, fz_device *devp, fz_shade *shade, const fz_matrix *ctm, float alpha)
{
fz_draw_device *dev = (fz_draw_device*)devp;
fz_rect bounds;
diff --git a/source/fitz/draw-mesh.c b/source/fitz/draw-mesh.c
index 3b031a55..00483f51 100644
--- a/source/fitz/draw-mesh.c
+++ b/source/fitz/draw-mesh.c
@@ -198,7 +198,7 @@ do_paint_tri(fz_context *ctx, void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex
}
void
-fz_paint_shade(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_irect *bbox)
+fz_paint_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_irect *bbox)
{
unsigned char clut[256][FZ_MAX_COLORS];
fz_pixmap *temp = NULL;
diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c
index 5ad6e305..e33f028c 100644
--- a/source/fitz/list-device.c
+++ b/source/fitz/list-device.c
@@ -948,7 +948,7 @@ fz_list_pop_clip(fz_context *ctx, fz_device *dev)
}
static void
-fz_list_fill_shade(fz_context *ctx, fz_device *dev, const fz_shade *shade, const fz_matrix *ctm, float alpha)
+fz_list_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha)
{
fz_shade *shade2 = fz_keep_shade(ctx, shade);
fz_rect rect;
diff --git a/source/fitz/shade.c b/source/fitz/shade.c
index 2a036770..1b1f3371 100644
--- a/source/fitz/shade.c
+++ b/source/fitz/shade.c
@@ -3,7 +3,7 @@
typedef struct fz_mesh_processor_s fz_mesh_processor;
struct fz_mesh_processor_s {
- const fz_shade *shade;
+ fz_shade *shade;
fz_mesh_prepare_fn *prepare;
fz_mesh_process_fn *process;
void *process_arg;
@@ -70,7 +70,7 @@ fz_prepare_vertex(fz_context *ctx, fz_mesh_processor *painter, fz_vertex *v, con
}
static void
-fz_process_mesh_type1(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_mesh_type1(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
{
float *p = shade->u.f.fn_vals;
int xdivs = shade->u.f.xdivs;
@@ -127,7 +127,7 @@ fz_point_on_circle(fz_point p, float r, float theta)
}
static void
-fz_process_mesh_type2(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_mesh_type2(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
{
fz_point p0, p1, dir;
fz_vertex v0, v1, v2, v3;
@@ -240,7 +240,7 @@ fz_paint_annulus(fz_context *ctx, const fz_matrix *ctm,
}
static void
-fz_process_mesh_type3(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_mesh_type3(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
{
fz_point p0, p1;
float r0, r1;
@@ -302,7 +302,7 @@ static inline float read_sample(fz_context *ctx, fz_stream *stream, int bits, fl
}
static void
-fz_process_mesh_type4(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_mesh_type4(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
{
fz_stream *stream = fz_open_compressed_buffer(ctx, shade->buffer);
fz_vertex v[4];
@@ -381,7 +381,7 @@ fz_process_mesh_type4(fz_context *ctx, const fz_shade *shade, const fz_matrix *c
}
static void
-fz_process_mesh_type5(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_mesh_type5(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
{
fz_stream *stream = fz_open_compressed_buffer(ctx, shade->buffer);
fz_vertex *buf = NULL;
@@ -696,7 +696,7 @@ make_tensor_patch(tensor_patch *p, int type, fz_point *pt)
#define SUBDIV 3 /* how many levels to subdivide patches */
static void
-fz_process_mesh_type6(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_mesh_type6(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
{
fz_stream *stream = fz_open_compressed_buffer(ctx, shade->buffer);
float color_storage[2][4][FZ_MAX_COLORS];
@@ -809,7 +809,7 @@ fz_process_mesh_type6(fz_context *ctx, const fz_shade *shade, const fz_matrix *c
}
static void
-fz_process_mesh_type7(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_mesh_type7(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
{
fz_stream *stream = fz_open_compressed_buffer(ctx, shade->buffer);
int bpflag = shade->u.m.bpflag;
@@ -922,7 +922,7 @@ fz_process_mesh_type7(fz_context *ctx, const fz_shade *shade, const fz_matrix *c
}
void
-fz_process_mesh(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm,
+fz_process_mesh(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm,
fz_mesh_prepare_fn *prepare, fz_mesh_process_fn *process, void *process_arg)
{
fz_mesh_processor painter;
@@ -952,7 +952,7 @@ fz_process_mesh(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm,
}
static fz_rect *
-fz_bound_mesh_type1(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
+fz_bound_mesh_type1(fz_context *ctx, fz_shade *shade, fz_rect *bbox)
{
bbox->x0 = shade->u.f.domain[0][0];
bbox->y0 = shade->u.f.domain[0][1];
@@ -962,7 +962,7 @@ fz_bound_mesh_type1(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
}
static fz_rect *
-fz_bound_mesh_type2(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
+fz_bound_mesh_type2(fz_context *ctx, fz_shade *shade, fz_rect *bbox)
{
/* FIXME: If axis aligned and not extended, the bbox may only be
* infinite in one direction */
@@ -971,7 +971,7 @@ fz_bound_mesh_type2(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
}
static fz_rect *
-fz_bound_mesh_type3(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
+fz_bound_mesh_type3(fz_context *ctx, fz_shade *shade, fz_rect *bbox)
{
fz_point p0, p1;
float r0, r1;
@@ -1016,7 +1016,7 @@ fz_bound_mesh_type3(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
}
static fz_rect *
-fz_bound_mesh_type4567(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
+fz_bound_mesh_type4567(fz_context *ctx, fz_shade *shade, fz_rect *bbox)
{
bbox->x0 = shade->u.m.x0;
bbox->y0 = shade->u.m.y0;
@@ -1026,7 +1026,7 @@ fz_bound_mesh_type4567(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
}
static fz_rect *
-fz_bound_mesh(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
+fz_bound_mesh(fz_context *ctx, fz_shade *shade, fz_rect *bbox)
{
if (shade->type == FZ_FUNCTION_BASED)
fz_bound_mesh_type1(ctx, shade, bbox);
@@ -1046,11 +1046,9 @@ fz_bound_mesh(fz_context *ctx, const fz_shade *shade, fz_rect *bbox)
}
fz_shade *
-fz_keep_shade(fz_context *ctx, const fz_shade *shadec)
+fz_keep_shade(fz_context *ctx, fz_shade *shade)
{
- fz_shade *shade = (fz_shade *)shadec;
-
- return (fz_shade *)fz_keep_storable(ctx, &shade->storable);
+ return fz_keep_storable(ctx, &shade->storable);
}
void
@@ -1067,15 +1065,13 @@ fz_drop_shade_imp(fz_context *ctx, fz_storable *shade_)
}
void
-fz_drop_shade(fz_context *ctx, const fz_shade *shadec)
+fz_drop_shade(fz_context *ctx, fz_shade *shade)
{
- fz_shade *shade = (fz_shade *)shadec;
-
fz_drop_storable(ctx, &shade->storable);
}
fz_rect *
-fz_bound_shade(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_rect *s)
+fz_bound_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_rect *s)
{
fz_matrix local_ctm;
fz_rect rect;
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c
index 67525ed4..584911c9 100644
--- a/source/fitz/svg-device.c
+++ b/source/fitz/svg-device.c
@@ -756,7 +756,7 @@ svg_dev_fill_image(fz_context *ctx, fz_device *dev, const fz_image *image, const
}
static void
-svg_dev_fill_shade(fz_context *ctx, fz_device *dev, const fz_shade *shade, const fz_matrix *ctm, float alpha)
+svg_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha)
{
svg_device *sdev = (svg_device*)dev;
fz_output *out = sdev->out;
diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c
index 065fa59e..946e636d 100644
--- a/source/fitz/test-device.c
+++ b/source/fitz/test-device.c
@@ -90,7 +90,7 @@ fz_test_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const
struct shadearg
{
fz_device *dev;
- const fz_shade *shade;
+ 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;
- const fz_shade *shade = arg->shade;
+ 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, const fz_shade *shade, const fz_matrix *ctm, float alpha)
+fz_test_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha)
{
if (shade->use_function)
{
diff --git a/source/fitz/trace-device.c b/source/fitz/trace-device.c
index 9f0acca3..81ab9156 100644
--- a/source/fitz/trace-device.c
+++ b/source/fitz/trace-device.c
@@ -261,7 +261,7 @@ fz_trace_fill_image(fz_context *ctx, fz_device *dev, const fz_image *image, cons
}
static void
-fz_trace_fill_shade(fz_context *ctx, fz_device *dev, const fz_shade *shade, const fz_matrix *ctm, float alpha)
+fz_trace_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha)
{
fz_output *out = ((fz_trace_device*)dev)->out;
fz_printf(ctx, out, "<fill_shade alpha=\"%g\"", alpha);