From a453f3131792ba4c790f135e8b60e314509b770f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 29 Jan 2018 00:03:50 +0000 Subject: call page render interface --- content/handlers/pdf/pdf.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'content') diff --git a/content/handlers/pdf/pdf.c b/content/handlers/pdf/pdf.c index 288aa5892..d62f1ffbb 100644 --- a/content/handlers/pdf/pdf.c +++ b/content/handlers/pdf/pdf.c @@ -29,6 +29,7 @@ #include #include +#include #include "utils/utils.h" #include "content/llcache.h" @@ -142,6 +143,16 @@ static bool pdf_convert(struct content *c) return true; } +static nspdferror +pdf_path(const struct nspdf_style *style, + const float *p, + unsigned int n, + const float transform[6], + const void *ctx) +{ + return NSPDFERROR_OK; +} + /* exported interface documented in image_cache.h */ static bool pdf_redraw(struct content *c, @@ -149,6 +160,22 @@ pdf_redraw(struct content *c, const struct rect *clip, const struct redraw_context *ctx) { + struct pdf_content *pdfc = (struct pdf_content *)c; + nspdferror pdfres; + struct nspdf_render_ctx render_ctx; + + render_ctx.ctx = ctx; + render_ctx.device_space[0] = 1; + render_ctx.device_space[1] = 0; + render_ctx.device_space[2] = 0; + render_ctx.device_space[3] = 1; + render_ctx.device_space[4] = 0; /* x offset */ + render_ctx.device_space[5] = -200; /* y offset */ + render_ctx.path = pdf_path; + + pdfres = nspdf_page_render(pdfc->doc, 0, &render_ctx); + + return true; } -- cgit v1.2.3