aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2014-12-10 23:42:16 +0100
committerThomas White <taw@bitwiz.org.uk>2014-12-10 23:42:16 +0100
commitfb3e555e5f3f42db4719d70bbb41697f05d1903a (patch)
tree109394b61d231c4f36cd30bad0808c66fa6920e3 /src
parentb9c2d02c6bbf19287a2d68d3ec9887b4bb49fb80 (diff)
Multiple stylesheets in rendering pipeline
Diffstat (limited to 'src')
-rw-r--r--src/render.c20
-rw-r--r--src/render.h4
-rw-r--r--src/sc_editor.c7
-rw-r--r--src/slideshow.c7
4 files changed, 28 insertions, 10 deletions
diff --git a/src/render.c b/src/render.c
index 719677a..9220750 100644
--- a/src/render.c
+++ b/src/render.c
@@ -345,7 +345,7 @@ static int recursive_wrap_and_draw(struct frame *fr, cairo_t *cr,
static void render_sc_to_surface(SCBlock *scblocks, cairo_surface_t *surf,
cairo_t *cr, double log_w, double log_h,
- SCBlock *stylesheet,
+ SCBlock **stylesheets,
ImageStore *is, enum is_size isz,
int slide_number)
{
@@ -391,7 +391,14 @@ static void render_sc_to_surface(SCBlock *scblocks, cairo_surface_t *surf,
add_macro(scin, "slidenumber", snum);
/* "The rendering pipeline" */
- if ( stylesheet != NULL ) sc_interp_run_stylesheet(scin, stylesheet);
+
+ if ( stylesheets != NULL ) {
+ int i = 0;
+ while ( stylesheets[i] != NULL ) {
+ sc_interp_run_stylesheet(scin, stylesheets[i]);
+ i++;
+ }
+ }
renew_frame(top);
sc_interp_add_blocks(scin, scblocks);
recursive_wrap_and_draw(top, cr, is, isz);
@@ -414,7 +421,7 @@ static void render_sc_to_surface(SCBlock *scblocks, cairo_surface_t *surf,
*/
cairo_surface_t *render_sc(SCBlock *scblocks, int w, int h,
double log_w, double log_h,
- SCBlock *stylesheet,
+ SCBlock **stylesheets,
ImageStore *is, enum is_size isz,
int slide_number)
{
@@ -425,7 +432,7 @@ cairo_surface_t *render_sc(SCBlock *scblocks, int w, int h,
cr = cairo_create(surf);
cairo_scale(cr, w/log_w, h/log_h);
render_sc_to_surface(scblocks, surf, cr, log_w, log_h,
- stylesheet, is, isz,slide_number);
+ stylesheets, is, isz,slide_number);
cairo_destroy(cr);
return surf;
}
@@ -454,8 +461,11 @@ int export_pdf(struct presentation *p, const char *filename)
for ( i=0; i<p->num_slides; i++ ) {
struct slide *s;
+ SCBlock *stylesheets[2];
s = p->slides[i];
+ stylesheets[0] = p->stylesheet;
+ stylesheets[1] = NULL;
cairo_save(cr);
@@ -466,7 +476,7 @@ int export_pdf(struct presentation *p, const char *filename)
cairo_fill(cr);
render_sc_to_surface(s->scblocks, surf, cr, p->slide_width,
- p->slide_height, p->stylesheet,
+ p->slide_height, stylesheets,
p->is, ISZ_SLIDESHOW, i);
cairo_restore(cr);
diff --git a/src/render.h b/src/render.h
index 37e66b2..0f51851 100644
--- a/src/render.h
+++ b/src/render.h
@@ -1,7 +1,7 @@
/*
* render.h
*
- * Copyright © 2013 Thomas White <taw@bitwiz.org.uk>
+ * Copyright © 2013-2014 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of Colloquium.
*
@@ -32,7 +32,7 @@
extern cairo_surface_t *render_sc(SCBlock *scblocks, int w, int h,
double log_w, double log_h,
- SCBlock *stylesheet,
+ SCBlock **stylesheets,
ImageStore *is, enum is_size isz,
int slide_number);
diff --git a/src/sc_editor.c b/src/sc_editor.c
index d0b7b97..726b373 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -69,12 +69,17 @@ void sc_editor_set_background(SCEditor *e, double r, double g, double b)
/* Update the view, once it's been edited in some way. */
static void rerender(SCEditor *e)
{
+ SCBlock *stylesheets[2];
+
if ( e->surface != NULL ) {
cairo_surface_destroy(e->surface);
}
+ stylesheets[0] = e->stylesheet;
+ stylesheets[1] = NULL;
+
e->surface = render_sc(e->scblocks, e->w, e->h, e->log_w, e->log_h,
- e->stylesheet, e->is, ISZ_EDITOR, e->slidenum);
+ stylesheets, e->is, ISZ_EDITOR, e->slidenum);
}
diff --git a/src/slideshow.c b/src/slideshow.c
index 4755ed6..34bb0d5 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -72,13 +72,16 @@ void redraw_slideshow(SlideShow *ss)
void slideshow_rerender(SlideShow *ss)
{
int n;
+ SCBlock *stylesheets[2];
+
+ stylesheets[0] = ss->p->stylesheet;
+ stylesheets[1] = NULL;
n = slide_number(ss->p, ss->cur_slide);
ss->surface = render_sc(ss->cur_slide->scblocks,
ss->slide_width, ss->slide_height,
ss->p->slide_width, ss->p->slide_height,
- ss->p->stylesheet,
- ss->p->is, ISZ_SLIDESHOW, n);
+ stylesheets, ss->p->is, ISZ_SLIDESHOW, n);
}