diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-07-06 14:20:26 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-08-10 12:09:10 +0200 |
commit | 0abcccc4aab4d893ac2a0ef116ff1f0c006fbc30 (patch) | |
tree | 8fe312208afaf28e2d759f4a1c53ec4ef131124f /platform/java/mupdf_native.c | |
parent | 6f8cb5606e426084160eaec82e9c11966e7fb5f4 (diff) | |
download | mupdf-0abcccc4aab4d893ac2a0ef116ff1f0c006fbc30.tar.xz |
Rejig pdf_update_page and pdf_update_annot.
The intent is for a user to iterate over the annotations on a page calling
pdf_update_annot for each one. If this function returns true, then the
annotation has changed since the last time it was called, and the user
needs to re-render.
pdf_update_page is a simple loop over the annotations on a page, for use
if you only care about page level granularity.
Users should no longer look at or change the pdf_annot.has_new_ap field.
Diffstat (limited to 'platform/java/mupdf_native.c')
-rw-r--r-- | platform/java/mupdf_native.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index 07331db4..1af5cb1f 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -8761,6 +8761,23 @@ FUN(PDFPage_deleteAnnotation)(JNIEnv *env, jobject self, jobject jannot) jni_rethrow(env, ctx); } +JNIEXPORT jboolean JNICALL +FUN(PDFPage_update)(JNIEnv *env, jobject self) +{ + fz_context *ctx = get_context(env); + pdf_page *page = from_PDFPage(env, self); + jboolean changed = 0; + + if (!ctx || !page) return 0; + + fz_try(ctx) + changed = pdf_update_page(ctx, page); + fz_catch(ctx) + jni_rethrow(env, ctx); + + return changed; +} + /* PDFAnnotation interface */ JNIEXPORT jint JNICALL @@ -9211,15 +9228,28 @@ FUN(PDFAnnotation_updateAppearance)(JNIEnv *env, jobject self) if (!ctx || !annot) return; fz_try(ctx) - { - pdf_dict_del(ctx, annot->obj, PDF_NAME(AP)); /* nuke old AP */ pdf_update_appearance(ctx, annot); - pdf_update_annot(ctx, annot); /* ensure new AP is put into annot */ - } fz_catch(ctx) jni_rethrow(env, ctx); } +JNIEXPORT jboolean JNICALL +FUN(PDFAnnotation_update)(JNIEnv *env, jobject self) +{ + fz_context *ctx = get_context(env); + pdf_annot *annot = from_PDFAnnotation(env, self); + jboolean changed = 0; + + if (!ctx || !annot) return 0; + + fz_try(ctx) + changed = pdf_update_annot(ctx, annot); + fz_catch(ctx) + jni_rethrow(env, ctx); + + return changed; +} + JNIEXPORT jobject JNICALL FUN(PDFAnnotation_getInkList)(JNIEnv *env, jobject self) { |