diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-03-19 20:19:06 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-03-20 11:29:00 +0000 |
commit | 6f1a3ce9dd2821042b146fb928c215b2d0549a3e (patch) | |
tree | b7bba8fcc16e4dffa7c4184e8373f8491802c75c /fitz/fitz-internal.h | |
parent | 9e937ba0965bcf11948a9b3ea5eb6d700df65bc9 (diff) | |
download | mupdf-6f1a3ce9dd2821042b146fb928c215b2d0549a3e.tar.xz |
Add caching of rendered tiles.
This requires a slight change to the device interface.
Callers that use fz_begin_tile will see no change (and no caching
will be done). We add a new fz_begin_tile_id function that takes an
extra 'id' parameter, and returns 0 or 1. If the id is 0 then the
function behaves exactly as fz_being_tile does, and always returns 0.
The PDF and XPS code continues to call the old (uncached) version.
The display list code however generates a unique id for every
BEGIN_TILE node, and passes this in.
If the id is non zero, then it is taken to be a unique identifier
for this tile; the implementer of the fz_begin_tile_id entry point
can choose to use this to implement caching. If it chooses to ignore
the id (and do no caching), it returns 0.
If the device implements caching, then it can check on entry for a
previously rendered tile with the appropriate matrix and a matching id.
If it finds one, then it returns 1. It is the callers responsibility
to then skip over all the device calls that would usually happen to
render the tiles (i.e. to skip forward to the matching 'END_TILE'
operation).
Diffstat (limited to 'fitz/fitz-internal.h')
-rw-r--r-- | fitz/fitz-internal.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h index 00c59cc5..b76510cf 100644 --- a/fitz/fitz-internal.h +++ b/fitz/fitz-internal.h @@ -473,6 +473,11 @@ struct fz_store_hash_s void *ptr; int i; } pi; + struct + { + int id; + float m[4]; + } im; } u; }; @@ -1440,7 +1445,7 @@ struct fz_device_s void (*begin_group)(fz_device *, const fz_rect *, int isolated, int knockout, int blendmode, float alpha); void (*end_group)(fz_device *); - void (*begin_tile)(fz_device *, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm); + int (*begin_tile)(fz_device *, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id); void (*end_tile)(fz_device *); int error_depth; @@ -1466,6 +1471,7 @@ void fz_end_mask(fz_device *dev); void fz_begin_group(fz_device *dev, const fz_rect *area, int isolated, int knockout, int blendmode, float alpha); void fz_end_group(fz_device *dev); void fz_begin_tile(fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm); +int fz_begin_tile_id(fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id); void fz_end_tile(fz_device *dev); fz_device *fz_new_device(fz_context *ctx, void *user); |