~ubuntu-branches/ubuntu/oneiric/evince/oneiric-updates

« back to all changes in this revision

Viewing changes to backend/impress/render.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2011-04-14 16:20:57 UTC
  • mfrom: (1.6.4 upstream)
  • mto: (1.3.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 138.
  • Revision ID: james.westby@ubuntu.com-20110414162057-0ofhbd139zs6ev6y
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 <config.h>
8
 
#include "common.h"
9
 
#include "internal.h"
10
 
 
11
 
ImpRenderCtx *
12
 
imp_create_context(const ImpDrawer *drw)
13
 
{
14
 
        ImpRenderCtx *ctx;
15
 
 
16
 
        ctx = calloc(1, sizeof(ImpRenderCtx));
17
 
        if (!ctx) return NULL;
18
 
        ctx->drw = drw;
19
 
        return ctx;
20
 
}
21
 
 
22
 
void
23
 
imp_context_set_page(ImpRenderCtx *ctx, ImpPage *page)
24
 
{
25
 
        ctx->page = page;
26
 
        ctx->content = page->doc->content;
27
 
        ctx->styles = page->doc->styles;
28
 
}
29
 
 
30
 
void
31
 
imp_context_set_step(ImpRenderCtx *ctx, int step)
32
 
{
33
 
        ctx->step = step;
34
 
}
35
 
 
36
 
void
37
 
imp_render(ImpRenderCtx *ctx, void *drw_data)
38
 
{
39
 
        // find drawing area size
40
 
        ctx->drw->get_size(drw_data, &ctx->pix_w, &ctx->pix_h);
41
 
        // find page size
42
 
        ctx->page->doc->get_geometry(ctx);
43
 
        // calculate ratio
44
 
        ctx->fact_x = ctx->pix_w / ctx->cm_w;
45
 
        ctx->fact_y = ctx->pix_h / ctx->cm_h;
46
 
        // call renderer
47
 
        ctx->page->doc->render_page(ctx, drw_data);
48
 
}
49
 
 
50
 
void
51
 
imp_delete_context(ImpRenderCtx *ctx)
52
 
{
53
 
        free(ctx);
54
 
}