summaryrefslogtreecommitdiff
path: root/source/fitz/shade.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-08-25 14:15:08 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-08-27 13:15:56 +0200
commit357162fe1eaec81638611d57ed178d8dfc3cdc47 (patch)
treeb246527baf85f66c1a3460f2860a5622b5bfa5bc /source/fitz/shade.c
parent95c1d14aff266ef9c544c97c669df2257a978e1c (diff)
downloadmupdf-357162fe1eaec81638611d57ed178d8dfc3cdc47.tar.xz
Allow NULL callback functions in the mesh processor.
Let either or both of the 'prepare' and 'process' callbacks be no-ops.
Diffstat (limited to 'source/fitz/shade.c')
-rw-r--r--source/fitz/shade.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source/fitz/shade.c b/source/fitz/shade.c
index 99a0b716..4c6b1472 100644
--- a/source/fitz/shade.c
+++ b/source/fitz/shade.c
@@ -5,7 +5,10 @@
static inline void
paint_tri(fz_mesh_processor *painter, fz_vertex *v0, fz_vertex *v1, fz_vertex *v2)
{
- painter->process(painter->process_arg, v0, v1, v2);
+ if (painter->process)
+ {
+ painter->process(painter->process_arg, v0, v1, v2);
+ }
}
static inline void
@@ -30,21 +33,30 @@ paint_quad(fz_mesh_processor *painter, fz_vertex *v0, fz_vertex *v1, fz_vertex *
* the process functions where it matters order the edges from top to
* bottom before walking them.
*/
- painter->process(painter->process_arg, v0, v1, v3);
- painter->process(painter->process_arg, v3, v2, v1);
+ if (painter->process)
+ {
+ painter->process(painter->process_arg, v0, v1, v3);
+ painter->process(painter->process_arg, v3, v2, v1);
+ }
}
static inline void
fz_prepare_color(fz_mesh_processor *painter, fz_vertex *v, float *c)
{
- painter->prepare(painter->process_arg, v, c);
+ if (painter->prepare)
+ {
+ painter->prepare(painter->process_arg, v, c);
+ }
}
static inline void
fz_prepare_vertex(fz_mesh_processor *painter, fz_vertex *v, const fz_matrix *ctm, float x, float y, float *c)
{
fz_transform_point_xy(&v->p, ctm, x, y);
- painter->prepare(painter->process_arg, v, c);
+ if (painter->prepare)
+ {
+ painter->prepare(painter->process_arg, v, c);
+ }
}
static void