summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2012-10-29 11:22:29 +0000
committerPaul Gardiner <paulg.artifex@glidos.net>2012-10-29 11:28:03 +0000
commitc16cadec123f6150cee4008aa4836fbb8ffb0db6 (patch)
treeac0bb7787e37045e69ed7ad64e1a0e9d95e311e4 /fitz
parent246d59d7c4a41bda9ef28ca38eba3be5f67726cc (diff)
downloadmupdf-c16cadec123f6150cee4008aa4836fbb8ffb0db6.tar.xz
Add fz_update_page
Regenerate dirty appearance streams and report changed annotations since last call. Also include a partial revert of changes in 96f335bc, that turn out not to be necessary. fz_update_page must now be called between each document-changing event and the next render. pdfapp.c and the android app have been updated to do so, but do not yet take advantage of the possibility to render only the updated areas of the screen.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/doc_interactive.c9
-rw-r--r--fitz/fitz.h30
2 files changed, 27 insertions, 12 deletions
diff --git a/fitz/doc_interactive.c b/fitz/doc_interactive.c
index f0a4f2ba..f2fb059d 100644
--- a/fitz/doc_interactive.c
+++ b/fitz/doc_interactive.c
@@ -16,9 +16,14 @@ int fz_pass_event(fz_interactive *idoc, fz_page *page, fz_ui_event *ui_event)
return pdf_pass_event((pdf_document*)idoc, (pdf_page*)page, ui_event);
}
-fz_rect *fz_poll_screen_update(fz_interactive *idoc)
+void fz_update_page(fz_interactive *idoc, fz_page *page)
{
- return pdf_poll_screen_update((pdf_document*)idoc);
+ pdf_update_page((pdf_document*)idoc, (pdf_page*)page);
+}
+
+fz_annot *fz_poll_changed_annot(fz_interactive *idoc, fz_page *page)
+{
+ return (fz_annot*)pdf_poll_changed_annot((pdf_document*)idoc, (pdf_page*)page);
}
fz_widget *fz_focused_widget(fz_interactive *idoc)
diff --git a/fitz/fitz.h b/fitz/fitz.h
index 590bcd45..89d9038f 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -2547,21 +2547,31 @@ int fz_has_unsaved_changes(fz_interactive *idoc);
int fz_pass_event(fz_interactive *idoc, fz_page *page, fz_ui_event *ui_event);
/*
- fz_init_ui_pointer_event: Set up a pointer event
+ fz_update_page: update a page for the sake of changes caused by a call
+ to fz_pass_event. fz_update_page regenerates any appearance streams that
+ are out of date, checks for cases where different appearance streams
+ should be selected because of state changes, and records internally
+ each annotation that has changed appearance. The list of chagned annotations
+ is then available via fz_poll_changed_annotation. Note that a call to
+ fz_pass_event for one page may lead to changes on any other, so an app
+ should call fz_update_page for every page it currently displays. Also
+ it is important that the fz_page object is the one used to last render
+ the page. If instead the app were to drop the page and reload it then
+ a call to fz_update_page would not reliably be able to report all changed
+ areas.
*/
-void fz_init_ui_pointer_event(fz_ui_event *event, int type, float x, float y);
+void fz_update_page(fz_interactive *idoc, fz_page *page);
/*
- fz_poll_screen_update: Get the bounding box of an area needing
- update because of a visual change.
+ fz_poll_changed_annot: enumerate the changed annotations recoreded
+ by a call to fz_update_page.
+*/
+fz_annot *fz_poll_changed_annot(fz_interactive *idoc, fz_page *page);
- After a sequence of interactions with a document that may cause
- it to change in appearance - such as passing ui events - this
- method should be called repeatedly until it returns NULL, to
- enumerate the changed areas for which screen updates are
- needed.
+/*
+ fz_init_ui_pointer_event: Set up a pointer event
*/
-fz_rect *fz_poll_screen_update(fz_interactive *idoc);
+void fz_init_ui_pointer_event(fz_ui_event *event, int type, float x, float y);
/*
fz_focused_widget: returns the currently focussed widget