summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-12-23 14:59:36 +0100
committerSebastian Rasmussen <sebras@gmail.com>2016-12-23 15:01:22 +0100
commit68cb0cbbdcce7bf2e1fb8ea0d07dfb87355162da (patch)
treee1f5f465169e2fa41fd2c9a623edbc1e1e6474d5 /platform
parent5688fc10c5e93618efff1345853cc1dd36c34554 (diff)
downloadmupdf-68cb0cbbdcce7bf2e1fb8ea0d07dfb87355162da.tar.xz
Remember to stroke the graphics in the fake document.
Additionally clean up the objects created for the fake document along with the document itself and report error to the caller by return code, not by using an exception.
Diffstat (limited to 'platform')
-rw-r--r--platform/x11/pdfapp.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index 7de62bf9..f421f82f 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -233,20 +233,22 @@ static int make_fake_doc(pdfapp_t *app)
fz_context *ctx = app->ctx;
pdf_document *pdf = NULL;
fz_buffer *contents = NULL;
+ pdf_obj *page_obj = NULL;
+
+ fz_var(contents);
+ fz_var(page_obj);
fz_try(ctx)
{
fz_rect mediabox = { 0, 0, app->winw, app->winh };
- pdf_obj *page_obj;
int i;
- contents = fz_new_buffer(ctx, 100);
pdf = pdf_create_document(ctx);
- app->doc = (fz_document*)pdf;
- fz_buffer_printf(ctx, contents, "1 0 0 rg %f w 0 0 m %f %f l 0 %f m %f 0 l\n",
- fz_min(mediabox.x1, mediabox.y1) / 4,
+ contents = fz_new_buffer(ctx, 100);
+ fz_buffer_printf(ctx, contents, "1 0 0 RG %f w 0 0 m %f %f l 0 %f m %f 0 l s\n",
+ fz_min(mediabox.x1, mediabox.y1) / 20,
mediabox.x1, mediabox.y1,
mediabox.y1, mediabox.x1);
@@ -256,16 +258,19 @@ static int make_fake_doc(pdfapp_t *app)
page_obj = pdf_add_page(ctx, pdf, &mediabox, 0, NULL, contents);
for (i = 0; i < app->pagecount; i++)
pdf_insert_page(ctx, pdf, -1, page_obj);
- pdf_drop_obj(ctx, page_obj);
}
fz_always(ctx)
{
+ pdf_drop_obj(ctx, page_obj);
fz_drop_buffer(ctx, contents);
}
fz_catch(ctx)
{
- fz_rethrow(ctx);
+ fz_drop_document(ctx, (fz_document *) pdf);
+ return 1;
}
+
+ app->doc = (fz_document*)pdf;
return 0;
}