diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-03-01 20:18:48 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-03-01 21:57:41 +0100 |
commit | f8751e3c36525a4ce69242c36b89e7d7116ffac2 (patch) | |
tree | d9be3be26e8b3f3f1ff8dbbe6716ea6827e70a2d /source/tools | |
parent | fbf50daa7e81ee111df3091048a9336ac29d371f (diff) | |
download | mupdf-f8751e3c36525a4ce69242c36b89e7d7116ffac2.tar.xz |
Don't use pdf_page struct when creating pages.
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/mudraw.c | 32 | ||||
-rw-r--r-- | source/tools/pdfcreate.c | 8 |
2 files changed, 19 insertions, 21 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 56bf0f8d..bc8ca1fb 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -378,29 +378,29 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) else if (output_format == OUT_PDF) { - fz_matrix ctm; - fz_rect bounds, tbounds; - pdf_page *newpage; - - fz_bound_page(ctx, page, &bounds); - fz_rotate(&ctm, rotation); - tbounds = bounds; - fz_transform_rect(&tbounds, &ctm); - - newpage = pdf_create_page(ctx, pdfout, &bounds, 0, NULL, NULL); + fz_buffer *contents; + pdf_obj *resources; + fz_rect mediabox; + dev = pdf_page_write(ctx, pdfout, &mediabox, &contents, &resources); fz_try(ctx) { - dev = pdf_page_write(ctx, pdfout, newpage); + pdf_obj *page_obj; + if (list) - fz_run_display_list(ctx, list, dev, &ctm, &tbounds, &cookie); + fz_run_display_list(ctx, list, dev, &fz_identity, NULL, &cookie); else - fz_run_page(ctx, page, dev, &ctm, &cookie); - fz_drop_device(ctx, dev); - dev = NULL; + 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); } fz_always(ctx) { + pdf_drop_obj(ctx, resources); + fz_drop_buffer(ctx, contents); fz_drop_device(ctx, dev); dev = NULL; } @@ -410,8 +410,6 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) fz_drop_page(ctx, page); fz_rethrow(ctx); } - pdf_insert_page(ctx, pdfout, newpage, INT_MAX); - fz_drop_page(ctx, &newpage->super); } else if (output_format == OUT_SVG) diff --git a/source/tools/pdfcreate.c b/source/tools/pdfcreate.c index 47572d7d..4ebc87fe 100644 --- a/source/tools/pdfcreate.c +++ b/source/tools/pdfcreate.c @@ -91,7 +91,7 @@ static void create_page(char *input) fz_buffer *contents; pdf_obj *resources; - pdf_page *page; + pdf_obj *page; resources = pdf_new_dict(ctx, doc, 2); contents = fz_new_buffer(ctx, 1024); @@ -133,9 +133,9 @@ static void create_page(char *input) } fz_drop_stream(ctx, stm); - page = pdf_create_page(ctx, doc, &mediabox, rotate, contents, resources); - pdf_insert_page(ctx, doc, page, INT_MAX); - pdf_drop_page(ctx, page); + page = pdf_add_page(ctx, doc, &mediabox, rotate, contents, resources); + pdf_insert_page(ctx, doc, -1, page); + pdf_drop_obj(ctx, page); fz_drop_buffer(ctx, contents); pdf_drop_obj(ctx, resources); |