summaryrefslogtreecommitdiff
path: root/source/tools/murun.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-06-18 16:55:30 +0200
committerRobin Watts <robin.watts@artifex.com>2018-06-22 16:48:50 +0100
commit66a23e616670fe19e966c833ac4c0db5edf57c7c (patch)
treeb682ae17bbc253c13a36b70100d4c548d1f7ac61 /source/tools/murun.c
parenta69f71e89bc9c325bc91fc0ec69f3ca231c83efe (diff)
downloadmupdf-66a23e616670fe19e966c833ac4c0db5edf57c7c.tar.xz
Use fz_quad type in structured text and selection/highlighting.
Diffstat (limited to 'source/tools/murun.c')
-rw-r--r--source/tools/murun.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c
index c74e4bbc..f7a890b2 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -489,6 +489,19 @@ static void ffi_pushrect(js_State *J, fz_rect rect)
js_pushnumber(J, rect.y1); js_setindex(J, -2, 3);
}
+static void ffi_pushquad(js_State *J, fz_quad quad)
+{
+ js_newarray(J);
+ js_pushnumber(J, quad.ul.x); js_setindex(J, -2, 0);
+ js_pushnumber(J, quad.ul.y); js_setindex(J, -2, 1);
+ js_pushnumber(J, quad.ur.x); js_setindex(J, -2, 0);
+ js_pushnumber(J, quad.ur.y); js_setindex(J, -2, 1);
+ js_pushnumber(J, quad.ll.x); js_setindex(J, -2, 0);
+ js_pushnumber(J, quad.ll.y); js_setindex(J, -2, 1);
+ js_pushnumber(J, quad.lr.x); js_setindex(J, -2, 0);
+ js_pushnumber(J, quad.lr.y); js_setindex(J, -2, 1);
+}
+
static fz_irect ffi_toirect(js_State *J, int idx)
{
fz_irect irect;
@@ -1922,7 +1935,7 @@ static void ffi_Page_search(js_State *J)
fz_context *ctx = js_getcontext(J);
fz_page *page = ffi_topage(J, 0);
const char *needle = js_tostring(J, 1);
- fz_rect hits[256];
+ fz_quad hits[256];
int i, n = 0;
fz_try(ctx)
@@ -1932,7 +1945,7 @@ static void ffi_Page_search(js_State *J)
js_newarray(J);
for (i = 0; i < n; ++i) {
- ffi_pushrect(J, hits[i]);
+ ffi_pushquad(J, hits[i]);
js_setindex(J, -2, i);
}
}
@@ -2777,7 +2790,7 @@ static void ffi_DisplayList_search(js_State *J)
fz_context *ctx = js_getcontext(J);
fz_display_list *list = js_touserdata(J, 0, "fz_display_list");
const char *needle = js_tostring(J, 1);
- fz_rect hits[256];
+ fz_quad hits[256];
int i, n = 0;
fz_try(ctx)
@@ -2787,7 +2800,7 @@ static void ffi_DisplayList_search(js_State *J)
js_newarray(J);
for (i = 0; i < n; ++i) {
- ffi_pushrect(J, hits[i]);
+ ffi_pushquad(J, hits[i]);
js_setindex(J, -2, i);
}
}
@@ -2797,7 +2810,7 @@ static void ffi_StructuredText_search(js_State *J)
fz_context *ctx = js_getcontext(J);
fz_stext_page *text = js_touserdata(J, 0, "fz_stext_page");
const char *needle = js_tostring(J, 1);
- fz_rect hits[256];
+ fz_quad hits[256];
int i, n = 0;
fz_try(ctx)
@@ -2807,7 +2820,7 @@ static void ffi_StructuredText_search(js_State *J)
js_newarray(J);
for (i = 0; i < n; ++i) {
- ffi_pushrect(J, hits[i]);
+ ffi_pushquad(J, hits[i]);
js_setindex(J, -2, i);
}
}
@@ -2818,7 +2831,7 @@ static void ffi_StructuredText_highlight(js_State *J)
fz_stext_page *text = js_touserdata(J, 0, "fz_stext_page");
fz_point a = ffi_topoint(J, 1);
fz_point b = ffi_topoint(J, 2);
- fz_rect hits[256];
+ fz_quad hits[256];
int i, n = 0;
fz_try(ctx)
@@ -2828,7 +2841,7 @@ static void ffi_StructuredText_highlight(js_State *J)
js_newarray(J);
for (i = 0; i < n; ++i) {
- ffi_pushrect(J, hits[i]);
+ ffi_pushquad(J, hits[i]);
js_setindex(J, -2, i);
}
}