summaryrefslogtreecommitdiff
path: root/fitz/fitz.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-01-04 18:33:33 +0000
committerRobin Watts <robin.watts@artifex.com>2012-01-04 19:13:41 +0000
commit2ae2a7b68381f0fc5940e983ccdec5b4cc08d188 (patch)
treea0ff2e359868cf6d4bcc6de7fabc06d9ade9774a /fitz/fitz.h
parent94439d77f23763d59457b9946ba35bd354ea4841 (diff)
downloadmupdf-2ae2a7b68381f0fc5940e983ccdec5b4cc08d188.tar.xz
Bug 692739: Add ability to abort time consuming actions
A new 'cookie' parameter is added to page rendering/interpretation functions. Supply this as NULL to get existing behaviour. If you supply a non-NULL cookie, then this is taken as a pointer to a struct that can be used for simple, non-thread locked communication between caller and library. The entire struct should be memset to zero before entry, except for specific flags (thus coping with future extensions to this struct). The abort flag should be zero on entry. It will be checked periodically by the library - if the caller sets it non-zero (via another thread) then the current operation will be aborted. No guarantees are given as to how often this will be checked, or how fast it will be responded to. The progress_max field will be set to an integer (-1 for unknown) representing the number of 'things' to do. The progress field will count up from 0 to this number as time goes by. No guarantees are made as to the accuracy of this information, but it should be useful for offering some sort of progress bar etc. Note that progress_max may increase during the job. In general, callers should be careful to accept out of range or invalid data in this structure as this is deliberately accessed 'unlocked'.
Diffstat (limited to 'fitz/fitz.h')
-rw-r--r--fitz/fitz.h15
1 files changed, 14 insertions, 1 deletions
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);
/*