diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-12-30 12:30:11 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-01-02 20:04:39 +0000 |
commit | a80817d4fcc27239fb2efa769ae84c542cbae904 (patch) | |
tree | 7760b79c3af301e17ece776a6244e51e2c697f1e /include/mupdf/fitz/shade.h | |
parent | bd7393d1be2e3905a6c3f1bb722198217c6195dc (diff) | |
download | mupdf-a80817d4fcc27239fb2efa769ae84c542cbae904.tar.xz |
Bug 694585: Slow rendering of meshes
In the existing code for meshes, we decompose the mesh down into
quads (or triangles) and then call a process routine to actually
do the work. This process routine typically maps each vertexes
position/color and plots it.
As each vertex is used several times by neighbouring patches, this
results in each vertex being processed several times. The fix in
this commit is therefore to break the processing into 'prepare' and
'process' phases. Each vertex is 'prepared' before being used in
the 'process' phase. This cuts the number of prepare operations in
half.
In testing, this reduced the time for a (release build, generating ppm
at default resolution) run from 33.4s to 23.5s.
Diffstat (limited to 'include/mupdf/fitz/shade.h')
-rw-r--r-- | include/mupdf/fitz/shade.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/mupdf/fitz/shade.h b/include/mupdf/fitz/shade.h index 6ea198dd..b33b832e 100644 --- a/include/mupdf/fitz/shade.h +++ b/include/mupdf/fitz/shade.h @@ -92,18 +92,20 @@ struct fz_vertex_s typedef struct fz_mesh_processor_s fz_mesh_processor; +typedef void (fz_mesh_prepare_fn)(void *arg, fz_vertex *v); typedef void (fz_mesh_process_fn)(void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv); struct fz_mesh_processor_s { fz_context *ctx; fz_shade *shade; + fz_mesh_prepare_fn *prepare; fz_mesh_process_fn *process; void *process_arg; int ncomp; }; void fz_process_mesh(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, - fz_mesh_process_fn *process, void *process_arg); + fz_mesh_prepare_fn *prepare, fz_mesh_process_fn *process, void *process_arg); #ifndef NDEBUG void fz_print_shade(fz_context *ctx, FILE *out, fz_shade *shade); |