]> www.fi.muni.cz Git - evince.git/blob - impress/render.c
New backend to support impress slides. Fixes bug #30867.
[evince.git] / impress / render.c
1 /* imposter (OO.org Impress viewer)
2 ** Copyright (C) 2003-2005 Gurer Ozen
3 ** This code is free software; you can redistribute it and/or
4 ** modify it under the terms of GNU General Public License.
5 */
6
7 #include "common.h"
8 #include "internal.h"
9
10 ImpRenderCtx *
11 imp_create_context(const ImpDrawer *drw)
12 {
13         ImpRenderCtx *ctx;
14
15         ctx = calloc(1, sizeof(ImpRenderCtx));
16         if (!ctx) return NULL;
17         ctx->drw = drw;
18         return ctx;
19 }
20
21 void
22 imp_context_set_page(ImpRenderCtx *ctx, ImpPage *page)
23 {
24         ctx->page = page;
25         ctx->content = page->doc->content;
26         ctx->styles = page->doc->styles;
27 }
28
29 void
30 imp_context_set_step(ImpRenderCtx *ctx, int step)
31 {
32         ctx->step = step;
33 }
34
35 void
36 imp_render(ImpRenderCtx *ctx, void *drw_data)
37 {
38         // find drawing area size
39         ctx->drw->get_size(drw_data, &ctx->pix_w, &ctx->pix_h);
40         // find page size
41         ctx->page->doc->get_geometry(ctx);
42         // calculate ratio
43         ctx->fact_x = ctx->pix_w / ctx->cm_w;
44         ctx->fact_y = ctx->pix_h / ctx->cm_h;
45         // call renderer
46         ctx->page->doc->render_page(ctx, drw_data);
47 }
48
49 void
50 imp_delete_context(ImpRenderCtx *ctx)
51 {
52         free(ctx);
53 }