From 4dbc82dac40cc8fa4c97a9835e4c4b80a13f5dac Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Tue, 24 Oct 2017 15:47:05 +0200 Subject: jni: Return correct inklist coordinates. --- source/pdf/pdf-annot-edit.c | 2 +- source/tools/murun.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c index ee3b1964..dbca68c6 100644 --- a/source/pdf/pdf-annot-edit.c +++ b/source/pdf/pdf-annot-edit.c @@ -743,7 +743,7 @@ pdf_annot_ink_list_stroke_count(fz_context *ctx, pdf_annot *annot, int i) check_allowed_subtypes(ctx, annot, PDF_NAME_InkList, ink_list_subtypes); ink_list = pdf_dict_get(ctx, annot->obj, PDF_NAME_InkList); stroke = pdf_array_get(ctx, ink_list, i); - return pdf_array_len(ctx, stroke); + return pdf_array_len(ctx, stroke) / 2; } void diff --git a/source/tools/murun.c b/source/tools/murun.c index 6754b32e..2e407c99 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -4158,7 +4158,7 @@ static void ffi_PDFAnnotation_getInkList(js_State *J) fz_catch(ctx) rethrow(J); - for (i = 0; i < n; ++n) { + for (i = 0; i < n; ++i) { fz_try(ctx) m = pdf_annot_ink_list_stroke_count(ctx, annot, i); fz_catch(ctx) @@ -4171,8 +4171,9 @@ static void ffi_PDFAnnotation_getInkList(js_State *J) fz_catch(ctx) rethrow(J); js_pushnumber(J, v[0]); + js_setindex(J, -2, k * 2 + 0); js_pushnumber(J, v[1]); - js_setindex(J, -2, k); + js_setindex(J, -2, k * 2 + 1); } js_setindex(J, -2, i); } -- cgit v1.2.3