diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-03-09 22:37:00 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-03-14 17:08:29 +0100 |
commit | d8125a13c05eef69a3fd3b6a9512dc573b23cc05 (patch) | |
tree | 91e5f76353b73abb5512b6deb7e4d1074ec02cc5 /source/tools | |
parent | 7350d67f358d4f04643f43003861290ab162eaec (diff) | |
download | mupdf-d8125a13c05eef69a3fd3b6a9512dc573b23cc05.tar.xz |
Remove begin_page and end_page device calls.
To be moved into a new document writer interface later.
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/mudraw.c | 8 | ||||
-rw-r--r-- | source/tools/murun.c | 54 |
2 files changed, 6 insertions, 56 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index d96b0a55..e00a6d23 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -247,6 +247,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) fz_device *dev = NULL; int start; fz_cookie cookie = { 0 }; + fz_rect mediabox; fz_var(list); fz_var(dev); @@ -262,6 +263,8 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) if (showmd5 || showtime || showfeatures) fprintf(stderr, "page %s %d", filename, pagenum); + fz_bound_page(ctx, page, &mediabox); + if (uselist) { fz_try(ctx) @@ -310,11 +313,14 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) { fz_try(ctx) { + fz_printf(ctx, out, "<page mediabox=\"%g %g %g %g\">\n", + mediabox.x0, mediabox.y0, mediabox.x1, mediabox.y1); dev = fz_new_trace_device(ctx, out); if (list) fz_run_display_list(ctx, list, dev, &fz_identity, &fz_infinite_rect, &cookie); else fz_run_page(ctx, page, dev, &fz_identity, &cookie); + fz_printf(ctx, out, "</page>\n"); } fz_always(ctx) { @@ -380,7 +386,6 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) { fz_buffer *contents; pdf_obj *resources; - fz_rect mediabox; dev = pdf_page_write(ctx, pdfout, &mediabox, &contents, &resources); fz_try(ctx) @@ -392,7 +397,6 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) else fz_run_page(ctx, page, dev, &fz_identity, &cookie); - fz_bound_page(ctx, page, &mediabox); page_obj = pdf_add_page(ctx, pdfout, &mediabox, rotation, contents, resources); pdf_insert_page(ctx, pdfout, -1, page_obj); pdf_drop_obj(ctx, page_obj); diff --git a/source/tools/murun.c b/source/tools/murun.c index e0207332..5275bfe2 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -757,32 +757,6 @@ typedef struct js_device_s } js_device; static void -js_dev_begin_page(fz_context *ctx, fz_device *dev, const fz_rect *rect, const fz_matrix *ctm) -{ - js_State *J = ((js_device*)dev)->J; - if (js_hasproperty(J, -1, "beginPage")) { - js_copy(J, -2); /* copy the 'this' object */ - ffi_pushrect(J, *rect); - ffi_pushmatrix(J, *ctm); - if (js_pcall(J, 2)) - fz_warn(ctx, "%s", js_tostring(J, -1)); - js_pop(J, 1); - } -} - -static void -js_dev_end_page(fz_context *ctx, fz_device *dev) -{ - js_State *J = ((js_device*)dev)->J; - if (js_hasproperty(J, -1, "endPage")) { - js_copy(J, -2); /* copy the 'this' object */ - if (js_pcall(J, 0)) - fz_warn(ctx, "%s", js_tostring(J, -1)); - js_pop(J, 1); - } -} - -static void js_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha) { @@ -1101,9 +1075,6 @@ static fz_device *new_js_device(fz_context *ctx, js_State *J) { js_device *dev = fz_new_device(ctx, sizeof *dev); - dev->super.begin_page = js_dev_begin_page; - dev->super.end_page = js_dev_end_page; - dev->super.fill_path = js_dev_fill_path; dev->super.stroke_path = js_dev_stroke_path; dev->super.clip_path = js_dev_clip_path; @@ -1136,28 +1107,6 @@ static fz_device *new_js_device(fz_context *ctx, js_State *J) /* device calling into c from js */ -static void ffi_Device_beginPage(js_State *J) -{ - fz_context *ctx = js_getcontext(J); - fz_device *dev = js_touserdata(J, 0, "fz_device"); - fz_rect rect = ffi_torect(J, 1); - fz_matrix ctm = ffi_tomatrix(J, 2); - fz_try(ctx) - fz_begin_page(ctx, dev, &rect, &ctm); - fz_catch(ctx) - rethrow(J); -} - -static void ffi_Device_endPage(js_State *J) -{ - fz_context *ctx = js_getcontext(J); - fz_device *dev = js_touserdata(J, 0, "fz_device"); - fz_try(ctx) - fz_end_page(ctx, dev); - fz_catch(ctx) - rethrow(J); -} - static void ffi_Device_fillPath(js_State *J) { fz_context *ctx = js_getcontext(J); @@ -2947,9 +2896,6 @@ int murun_main(int argc, char **argv) js_newobject(J); { - jsB_propfun(J, "Device.beginPage", ffi_Device_beginPage, 2); - jsB_propfun(J, "Device.endPage", ffi_Device_endPage, 0); - jsB_propfun(J, "Device.fillPath", ffi_Device_fillPath, 6); jsB_propfun(J, "Device.strokePath", ffi_Device_strokePath, 6); jsB_propfun(J, "Device.clipPath", ffi_Device_clipPath, 3); |