summaryrefslogtreecommitdiff
path: root/android/jni/mupdf.c
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2013-02-21 13:50:12 +0000
committerRobin Watts <robin.watts@artifex.com>2013-02-26 19:02:00 +0000
commitdf1f7eb75709a95fdf3838976ebdf49a46430c3b (patch)
treef0408c021bdd3ba6b0498d82a9bc72d780ae8ed4 /android/jni/mupdf.c
parent5d6087bbce6ad9177244f823f38eee802a2aa23c (diff)
downloadmupdf-df1f7eb75709a95fdf3838976ebdf49a46430c3b.tar.xz
Android: implement annotation deletion
Diffstat (limited to 'android/jni/mupdf.c')
-rw-r--r--android/jni/mupdf.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c
index d2aa124f..88c7a8c6 100644
--- a/android/jni/mupdf.c
+++ b/android/jni/mupdf.c
@@ -1477,6 +1477,38 @@ JNI_FN(MuPDFCore_addStrikeOutAnnotationInternal)(JNIEnv * env, jobject thiz, job
}
}
+JNIEXPORT void JNICALL
+JNI_FN(MuPDFCore_deleteAnnotationInternal)(JNIEnv * env, jobject thiz, int annot_index)
+{
+ globals *glo = get_globals(env, thiz);
+ fz_context *ctx = glo->ctx;
+ fz_document *doc = glo->doc;
+ fz_interactive *idoc = fz_interact(doc);
+ page_cache *pc = &glo->pages[glo->current];
+ fz_annot *annot;
+ int i;
+
+ if (idoc == NULL)
+ return;
+
+ fz_try(ctx)
+ {
+ annot = fz_first_annot(glo->doc, pc->page);
+ for (i = 0; i < annot_index && annot; i++)
+ annot = fz_next_annot(glo->doc, annot);
+
+ if (annot)
+ {
+ fz_delete_annot(idoc, pc->page, annot);
+ dump_annotation_display_lists(glo);
+ }
+ }
+ fz_catch(ctx)
+ {
+ LOGE("deleteAnnotationInternal: %s", ctx->error->message);
+ }
+}
+
static void close_doc(globals *glo)
{
int i;