diff options
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/dev_list.c | 17 | ||||
-rw-r--r-- | fitz/fitz.h | 15 |
2 files changed, 30 insertions, 2 deletions
diff --git a/fitz/dev_list.c b/fitz/dev_list.c index 376cdac8..c6a71ec9 100644 --- a/fitz/dev_list.c +++ b/fitz/dev_list.c @@ -591,7 +591,7 @@ fz_free_display_list(fz_context *ctx, fz_display_list *list) } void -fz_execute_display_list(fz_display_list *list, fz_device *dev, fz_matrix top_ctm, fz_bbox scissor) +fz_execute_display_list(fz_display_list *list, fz_device *dev, fz_matrix top_ctm, fz_bbox scissor, fz_cookie *cookie) { fz_display_node *node; fz_matrix ctm; @@ -600,6 +600,7 @@ fz_execute_display_list(fz_display_list *list, fz_device *dev, fz_matrix top_ctm int clipped = 0; int tiled = 0; int empty; + int progress = 0; if (!fz_is_infinite_bbox(scissor)) { @@ -609,8 +610,22 @@ fz_execute_display_list(fz_display_list *list, fz_device *dev, fz_matrix top_ctm scissor.x1 += 20; scissor.y1 += 20; } + if (cookie) + { + cookie->progress_max = list->last - list->first; + cookie->progress = 0; + } + for (node = list->first; node; node = node->next) { + /* Check the cookie for aborting */ + if (cookie) + { + if (cookie->abort) + break; + cookie->progress = progress++; + } + /* cull objects to draw using a quick visibility test */ if (tiled || node->cmd == FZ_CMD_BEGIN_TILE || node->cmd == FZ_CMD_END_TILE) diff --git a/fitz/fitz.h b/fitz/fitz.h index d79d39f2..becd5df9 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -1150,6 +1150,19 @@ void fz_debug_text_span_xml(fz_text_span *span); fz_device *fz_new_text_device(fz_context *ctx, fz_text_span *text); /* + * Cookie support - simple communication channel between app/library. + */ + +typedef struct fz_cookie_s fz_cookie; + +struct fz_cookie_s +{ + int abort; + int progress; + int progress_max; /* -1 for unknown */ +}; + +/* * Display list device -- record and play back device commands. */ @@ -1158,7 +1171,7 @@ typedef struct fz_display_list_s fz_display_list; fz_display_list *fz_new_display_list(fz_context *ctx); void fz_free_display_list(fz_context *ctx, fz_display_list *list); fz_device *fz_new_list_device(fz_context *ctx, fz_display_list *list); -void fz_execute_display_list(fz_display_list *list, fz_device *dev, fz_matrix ctm, fz_bbox area); +void fz_execute_display_list(fz_display_list *list, fz_device *dev, fz_matrix ctm, fz_bbox area, fz_cookie *cookie); /* |