summaryrefslogtreecommitdiff
path: root/source/tools/mudraw.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-03-01 20:18:48 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-03-01 21:57:41 +0100
commitf8751e3c36525a4ce69242c36b89e7d7116ffac2 (patch)
treed9be3be26e8b3f3f1ff8dbbe6716ea6827e70a2d /source/tools/mudraw.c
parentfbf50daa7e81ee111df3091048a9336ac29d371f (diff)
downloadmupdf-f8751e3c36525a4ce69242c36b89e7d7116ffac2.tar.xz
Don't use pdf_page struct when creating pages.
Diffstat (limited to 'source/tools/mudraw.c')
-rw-r--r--source/tools/mudraw.c32
1 files changed, 15 insertions, 17 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)