summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/fitz/shade.h26
-rw-r--r--source/fitz/draw-mesh.c2
-rw-r--r--source/fitz/shade.c36
-rw-r--r--source/fitz/test-device.c2
4 files changed, 34 insertions, 32 deletions
diff --git a/include/mupdf/fitz/shade.h b/include/mupdf/fitz/shade.h
index 59ff7b97..5358cde2 100644
--- a/include/mupdf/fitz/shade.h
+++ b/include/mupdf/fitz/shade.h
@@ -136,32 +136,34 @@ struct fz_vertex_s
};
/*
- fz_mesh_prepare_fn: Callback function type for use with
- fz_process_mesh.
+ fz_shade_prepare_fn: Callback function type for use with
+ fz_process_shade.
- arg: Opaque pointer from fz_process_mesh caller.
+ arg: Opaque pointer from fz_process_shade caller.
v: Pointer to a fz_vertex structure to populate.
c: Pointer to an array of floats to use to populate v.
*/
-typedef void (fz_mesh_prepare_fn)(fz_context *ctx, void *arg, fz_vertex *v, const float *c);
+typedef void (fz_shade_prepare_fn)(fz_context *ctx, void *arg, fz_vertex *v, const float *c);
/*
- fz_mesh_process_fn: Callback function type for use with
- fz_process_mesh.
+ fz_shade_process_fn: Callback function type for use with
+ fz_process_shade.
- arg: Opaque pointer from fz_process_mesh caller.
+ arg: Opaque pointer from fz_process_shade caller.
av, bv, cv: Pointers to a fz_vertex structure describing
the corner locations and colors of a triangle to be
filled.
*/
-typedef void (fz_mesh_process_fn)(fz_context *ctx, void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv);
+typedef void (fz_shade_process_fn)(fz_context *ctx, void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv);
/*
- fz_process_mesh: Process a mesh, using supplied callback
- functions.
+ fz_process_shade: Process a shade, using supplied callback
+ functions. This decomposes the shading to a mesh (even ones
+ that are not natively meshes, such as linear or radial
+ shadings), and processes triangles from those meshes.
shade: The shade to process.
@@ -178,8 +180,8 @@ typedef void (fz_mesh_process_fn)(fz_context *ctx, void *arg, fz_vertex *av, fz_
process_arg: An opaque argument passed through from caller
to callback functions.
*/
-void 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);
+void fz_process_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm,
+ fz_shade_prepare_fn *prepare, fz_shade_process_fn *process, void *process_arg);
/*
fz_print_shade: Output a textual representation of
diff --git a/source/fitz/draw-mesh.c b/source/fitz/draw-mesh.c
index 4f90c461..233a2108 100644
--- a/source/fitz/draw-mesh.c
+++ b/source/fitz/draw-mesh.c
@@ -248,7 +248,7 @@ fz_paint_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_pixmap
ptd.bbox = bbox;
fz_init_cached_color_converter(ctx, &ptd.cc, temp->colorspace, shade->colorspace);
- fz_process_mesh(ctx, shade, &local_ctm, &prepare_mesh_vertex, &do_paint_tri, &ptd);
+ fz_process_shade(ctx, shade, &local_ctm, &prepare_mesh_vertex, &do_paint_tri, &ptd);
if (shade->use_function)
{
diff --git a/source/fitz/shade.c b/source/fitz/shade.c
index 8f82eb72..b4f4b0c7 100644
--- a/source/fitz/shade.c
+++ b/source/fitz/shade.c
@@ -4,8 +4,8 @@ typedef struct fz_mesh_processor_s fz_mesh_processor;
struct fz_mesh_processor_s {
fz_shade *shade;
- fz_mesh_prepare_fn *prepare;
- fz_mesh_process_fn *process;
+ fz_shade_prepare_fn *prepare;
+ fz_shade_process_fn *process;
void *process_arg;
int ncomp;
};
@@ -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, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_shade_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, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_shade_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, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_shade_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, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_shade_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, fz_shade *shade, const fz_matrix *ctm, fz
}
static void
-fz_process_mesh_type5(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_shade_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, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_shade_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, fz_shade *shade, const fz_matrix *ctm, fz
}
static void
-fz_process_mesh_type7(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_mesh_processor *painter)
+fz_process_shade_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,8 +922,8 @@ fz_process_mesh_type7(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz
}
void
-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_process_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm,
+ fz_shade_prepare_fn *prepare, fz_shade_process_fn *process, void *process_arg)
{
fz_mesh_processor painter;
@@ -934,19 +934,19 @@ fz_process_mesh(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm,
painter.ncomp = (shade->use_function > 0 ? 1 : fz_colorspace_n(ctx, shade->colorspace));
if (shade->type == FZ_FUNCTION_BASED)
- fz_process_mesh_type1(ctx, shade, ctm, &painter);
+ fz_process_shade_type1(ctx, shade, ctm, &painter);
else if (shade->type == FZ_LINEAR)
- fz_process_mesh_type2(ctx, shade, ctm, &painter);
+ fz_process_shade_type2(ctx, shade, ctm, &painter);
else if (shade->type == FZ_RADIAL)
- fz_process_mesh_type3(ctx, shade, ctm, &painter);
+ fz_process_shade_type3(ctx, shade, ctm, &painter);
else if (shade->type == FZ_MESH_TYPE4)
- fz_process_mesh_type4(ctx, shade, ctm, &painter);
+ fz_process_shade_type4(ctx, shade, ctm, &painter);
else if (shade->type == FZ_MESH_TYPE5)
- fz_process_mesh_type5(ctx, shade, ctm, &painter);
+ fz_process_shade_type5(ctx, shade, ctm, &painter);
else if (shade->type == FZ_MESH_TYPE6)
- fz_process_mesh_type6(ctx, shade, ctm, &painter);
+ fz_process_shade_type6(ctx, shade, ctm, &painter);
else if (shade->type == FZ_MESH_TYPE7)
- fz_process_mesh_type7(ctx, shade, ctm, &painter);
+ fz_process_shade_type7(ctx, shade, ctm, &painter);
else
fz_throw(ctx, FZ_ERROR_GENERIC, "Unexpected mesh type %d\n", shade->type);
}
diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c
index 1c1aa628..abe27dbb 100644
--- a/source/fitz/test-device.c
+++ b/source/fitz/test-device.c
@@ -169,7 +169,7 @@ fz_test_fill_shade(fz_context *ctx, fz_device *dev_, fz_shade *shade, const fz_m
struct shadearg arg;
arg.dev = dev;
arg.shade = shade;
- fz_process_mesh(ctx, shade, ctm, prepare_vertex, NULL, &arg);
+ fz_process_shade(ctx, shade, ctm, prepare_vertex, NULL, &arg);
}
}
}