diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-09-22 16:00:21 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-10-07 17:22:58 +0200 |
commit | 8e244f7e2add3606283c0c797d75067fd01ad740 (patch) | |
tree | 1d3d70646b637792865c0b14be37127eb5eef250 /platform/android/viewer | |
parent | 170f35a5802ec7093b00fb2e39bbde3756516f15 (diff) | |
download | mupdf-8e244f7e2add3606283c0c797d75067fd01ad740.tar.xz |
Remove separate tmp/deleted/changed annotation lists.
Use a flag in the pdf_annot struct instead.
Don't pass pdf_document to annotation edit functions.
Diffstat (limited to 'platform/android/viewer')
-rw-r--r-- | platform/android/viewer/jni/mupdf.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/platform/android/viewer/jni/mupdf.c b/platform/android/viewer/jni/mupdf.c index b682296c..96dc36df 100644 --- a/platform/android/viewer/jni/mupdf.c +++ b/platform/android/viewer/jni/mupdf.c @@ -669,21 +669,27 @@ JNI_FN(MuPDFCore_javascriptSupported)(JNIEnv *env, jobject thiz) static void update_changed_rects(globals *glo, page_cache *pc, pdf_document *idoc) { fz_context *ctx = glo->ctx; - fz_annot *annot; + pdf_page *ppage = (pdf_page*)pc->page; + pdf_annot *pannot; - pdf_update_page(ctx, idoc, (pdf_page *)pc->page); - while ((annot = (fz_annot *)pdf_poll_changed_annot(ctx, idoc, (pdf_page *)pc->page)) != NULL) + pdf_update_page(ctx, ppage); + for (pannot = pdf_first_annot(ctx, ppage); pannot; pannot = pdf_next_annot(ctx, pannot)) { - /* FIXME: We bound the annot twice here */ - rect_node *node = fz_malloc_struct(glo->ctx, rect_node); - fz_bound_annot(ctx, annot, &node->rect); - node->next = pc->changed_rects; - pc->changed_rects = node; - - node = fz_malloc_struct(glo->ctx, rect_node); - fz_bound_annot(ctx, annot, &node->rect); - node->next = pc->hq_changed_rects; - pc->hq_changed_rects = node; + if (pannot->changed) + { + fz_annot *annot = (fz_annot*)pannot; + + /* FIXME: We bound the annot twice here */ + rect_node *node = fz_malloc_struct(ctx, rect_node); + fz_bound_annot(ctx, annot, &node->rect); + node->next = pc->changed_rects; + pc->changed_rects = node; + + node = fz_malloc_struct(ctx, rect_node); + fz_bound_annot(ctx, annot, &node->rect); + node->next = pc->hq_changed_rects; + pc->hq_changed_rects = node; + } } } @@ -1740,7 +1746,7 @@ JNI_FN(MuPDFCore_deleteAnnotationInternal)(JNIEnv * env, jobject thiz, int annot if (annot) { - pdf_delete_annot(ctx, idoc, (pdf_page *)pc->page, (pdf_annot *)annot); + pdf_delete_annot(ctx, (pdf_page *)pc->page, (pdf_annot *)annot); dump_annotation_display_lists(glo); } } |