aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/render.c b/src/render.c
index 8e1645e..f42d2cc 100644
--- a/src/render.c
+++ b/src/render.c
@@ -328,11 +328,12 @@ void free_render_buffers_except_thumb(struct slide *s)
static void render_slide_to_surface(struct slide *s, cairo_surface_t *surf,
cairo_t *cr, enum is_size isz,
double scale, double w, double h,
- ImageStore *is)
+ ImageStore *is, int slide_number)
{
PangoFontMap *fontmap;
PangoContext *pc;
SCInterpreter *scin;
+ char snum[64];
cairo_scale(cr, scale, scale);
@@ -358,6 +359,9 @@ static void render_slide_to_surface(struct slide *s, cairo_surface_t *surf,
return;
}
+ snprintf(snum, 63, "%i", slide_number);
+ add_macro(scin, "slidenumber", snum);
+
/* "The rendering pipeline" */
sc_interp_run_stylesheet(scin, s->parent->stylesheet);
renew_frame(s->top);
@@ -380,7 +384,8 @@ static void render_slide_to_surface(struct slide *s, cairo_surface_t *surf,
* Render the entire slide.
*/
cairo_surface_t *render_slide(struct slide *s, int w, double ww, double hh,
- ImageStore *is, enum is_size isz)
+ ImageStore *is, enum is_size isz,
+ int slide_number)
{
cairo_surface_t *surf;
cairo_t *cr;
@@ -397,7 +402,8 @@ cairo_surface_t *render_slide(struct slide *s, int w, double ww, double hh,
surf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h);
cr = cairo_create(surf);
- render_slide_to_surface(s, surf, cr, isz, scale, w, h, is);
+ render_slide_to_surface(s, surf, cr, isz, scale, w, h, is,
+ slide_number);
cairo_destroy(cr);
return surf;
}
@@ -441,7 +447,7 @@ int export_pdf(struct presentation *p, const char *filename)
s->top->h = w*r;
render_slide_to_surface(s, surf, cr, ISZ_SLIDESHOW, scale,
- w, w*r, p->is);
+ w, w*r, p->is, i);
cairo_restore(cr);