diff options
author | Paul Gardiner <paulg.artifex@glidos.net> | 2013-06-21 13:41:37 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-06-24 14:57:43 +0100 |
commit | f07fedd90e5d08fba4687283a29760d08cde8d0c (patch) | |
tree | 9bab0db9c72377d2979b4d9d8a44cdfdcb9bf534 /source/pdf/pdf-form.c | |
parent | 668540820dfd12121d78057abd11cbd6b25eacdf (diff) | |
download | mupdf-f07fedd90e5d08fba4687283a29760d08cde8d0c.tar.xz |
Update annotation handling in preparation for incremental update
When incremental update is in place, functions that alter one structure may
have the side-effect of altering another: i.e., updating an annotation may
require the Annots array or even the page to be cloned. This commit makes
the existing annotation code hardy to this eventuallity. It also cleans up
a slight mess of the past where not all annotation-altering functions had
access to the pdf_annot struture, instead having to work with just the
pdf object.
Diffstat (limited to 'source/pdf/pdf-form.c')
-rw-r--r-- | source/pdf/pdf-form.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c index 6e1d26ce..41b15752 100644 --- a/source/pdf/pdf-form.c +++ b/source/pdf/pdf-form.c @@ -1717,7 +1717,7 @@ static void execute_action(pdf_document *doc, pdf_obj *obj, pdf_obj *a) } } -static void update_text_markup_appearance(pdf_document *doc, pdf_obj *annot, fz_annot_type type) +static void update_text_markup_appearance(pdf_document *doc, pdf_annot *annot, fz_annot_type type) { float color[3]; float alpha; @@ -1754,11 +1754,12 @@ static void update_text_markup_appearance(pdf_document *doc, pdf_obj *annot, fz_ return; } - pdf_set_markup_obj_appearance(doc, annot, color, alpha, line_thickness, line_height); + pdf_set_markup_appearance(doc, annot, color, alpha, line_thickness, line_height); } -void pdf_update_appearance(pdf_document *doc, pdf_obj *obj) +void pdf_update_appearance(pdf_document *doc, pdf_annot *annot) { + pdf_obj *obj = annot->obj; if (!pdf_dict_gets(obj, "AP") || pdf_dict_gets(obj, "Dirty")) { fz_annot_type type = pdf_annot_obj_type(obj); @@ -1803,10 +1804,10 @@ void pdf_update_appearance(pdf_document *doc, pdf_obj *obj) case FZ_ANNOT_STRIKEOUT: case FZ_ANNOT_UNDERLINE: case FZ_ANNOT_HIGHLIGHT: - update_text_markup_appearance(doc, obj, type); + update_text_markup_appearance(doc, annot, type); break; case FZ_ANNOT_INK: - pdf_set_ink_obj_appearance(doc, obj); + pdf_set_ink_appearance(doc, annot); break; default: break; |