summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-07-02 12:06:05 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-07-05 15:32:34 +0200
commit4cda8ae62880a807a3b19d68b5407eafeea6e338 (patch)
tree2288e7e6e86f4ed5c724fa0b6d91a8f0e94e28b0
parent100606af20710f8e335ace0fd0a34e78208d28dc (diff)
downloadmupdf-4cda8ae62880a807a3b19d68b5407eafeea6e338.tar.xz
Return true if any annots have new APs in pdf_update_page.
-rw-r--r--include/mupdf/pdf/document.h32
-rw-r--r--source/pdf/pdf-form.c14
2 files changed, 25 insertions, 21 deletions
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h
index 5ab0fa2c..57e726d3 100644
--- a/include/mupdf/pdf/document.h
+++ b/include/mupdf/pdf/document.h
@@ -514,20 +514,24 @@ int pdf_add_portfolio_entry(fz_context *ctx, pdf_document *doc,
void pdf_set_portfolio_entry_info(fz_context *ctx, pdf_document *doc, int entry, int schema_entry, pdf_obj *data);
/*
- pdf_update_page: update a page for the sake of changes caused by a call
- to pdf_pass_event. pdf_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 changed annotations
- is then available via querying the annot->changed flag. Note that a call to
- pdf_pass_event for one page may lead to changes on any other, so an app
- should call pdf_update_page for every page it currently displays. Also
- it is important that the pdf_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 pdf_update_page would not reliably be able to report all changed
- areas.
-*/
-void pdf_update_page(fz_context *ctx, pdf_page *page);
+ pdf_update_page: Update a page for the sake of changes caused by a call
+ to pdf_pass_event or annotation editing functions.
+
+ pdf_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.
+
+ Each annotation that has changed has its has_new_ap flag set to true.
+
+ Note that a call to pdf_pass_event for one page may lead to changes on
+ any other, so an app should call pdf_update_page for every page it
+ currently displays. Also it is important that the pdf_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 pdf_update_page would not
+ reliably be able to report all changed areas.
+*/
+int pdf_update_page(fz_context *ctx, pdf_page *page);
/*
Determine whether changes have been made since the
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c
index 93b88e2c..16811edd 100644
--- a/source/pdf/pdf-form.c
+++ b/source/pdf/pdf-form.c
@@ -42,14 +42,10 @@ static void pdf_field_mark_dirty(fz_context *ctx, pdf_document *doc, pdf_obj *fi
if (kids)
{
int i, n = pdf_array_len(ctx, kids);
-
for (i = 0; i < n; i++)
pdf_field_mark_dirty(ctx, doc, pdf_array_get(ctx, kids, i));
}
- else
- {
- pdf_dirty_obj(ctx, field);
- }
+ pdf_dirty_obj(ctx, field);
}
static void update_field_value(fz_context *ctx, pdf_document *doc, pdf_obj *obj, const char *text)
@@ -622,14 +618,18 @@ int pdf_pass_event(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_ui_ev
return changed;
}
-void pdf_update_page(fz_context *ctx, pdf_page *page)
+int
+pdf_update_page(fz_context *ctx, pdf_page *page)
{
pdf_annot *annot;
-
+ int changed = 0;
for (annot = page->annots; annot; annot = annot->next)
{
pdf_update_annot(ctx, annot);
+ if (annot->has_new_ap)
+ changed = 1;
}
+ return changed;
}
pdf_widget *pdf_focused_widget(fz_context *ctx, pdf_document *doc)