summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-02-27 14:20:36 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-02-27 17:47:54 +0100
commit8ebca3d5481961f56b5754ab4cfa9544f58c5b0b (patch)
tree63ba1f4a7f228234eb4fd6cf13f682a653519076 /source/tools
parentce03adbff727cfad99e7103068b73f7782cbc9f7 (diff)
downloadmupdf-8ebca3d5481961f56b5754ab4cfa9544f58c5b0b.tar.xz
Use fz_point for pdf_set_annot_ink_list and vertices too.
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/murun.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c
index fd6c2c0d..bed686a7 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -4281,7 +4281,7 @@ static void ffi_PDFAnnotation_setInkList(js_State *J)
{
fz_context *ctx = js_getcontext(J);
pdf_annot *annot = js_touserdata(J, 0, "pdf_annot");
- float *points = NULL;
+ fz_point *points = NULL;
int *counts = NULL;
int n, nv, k, i, v;
@@ -4298,7 +4298,7 @@ static void ffi_PDFAnnotation_setInkList(js_State *J)
fz_try(ctx) {
counts = fz_malloc(ctx, n * sizeof(int));
- points = fz_malloc(ctx, nv * 2 * sizeof(float));
+ points = fz_malloc(ctx, nv * sizeof(fz_point));
} fz_catch(ctx) {
fz_free(ctx, counts);
fz_free(ctx, points);
@@ -4313,10 +4313,14 @@ static void ffi_PDFAnnotation_setInkList(js_State *J)
for (i = v = 0; i < n; ++i) {
js_getindex(J, 1, i);
counts[i] = js_getlength(J, -1) / 2;
- for (k = 0; k < counts[i] * 2; ++k) {
- js_getindex(J, -1, k);
- points[v++] = js_tonumber(J, -1);
+ for (k = 0; k < counts[i]; ++k) {
+ js_getindex(J, -1, k*2);
+ points[v].x = js_tonumber(J, -1);
+ js_pop(J, 1);
+ js_getindex(J, -1, k*2+1);
+ points[v].y = js_tonumber(J, -1);
js_pop(J, 1);
+ ++v;
}
js_pop(J, 1);
}