diff options
author | Thomas White <taw@bitwiz.org.uk> | 2013-05-15 20:42:48 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2013-05-15 20:42:48 +0200 |
commit | d345f02739739c66ae00d2d5e210b83f43ff1500 (patch) | |
tree | 6265ca0a808e59d3eb6eafd27fd6b69668c44eb3 /src/render.c | |
parent | d630b6544142b9537bdf6051e25a6ea28ed88377 (diff) |
Create image frames
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 101 |
1 files changed, 36 insertions, 65 deletions
diff --git a/src/render.c b/src/render.c index fe52a26..3555455 100644 --- a/src/render.c +++ b/src/render.c @@ -279,66 +279,60 @@ static int render_sc(struct frame *fr, double scale) static int render_frame(struct frame *fr, double scale) { - if ( fr->num_children > 0 ) { - - int i; - - /* Render all subframes */ - for ( i=0; i<fr->num_children; i++ ) { - - struct frame *ch = fr->children[i]; - double mtot; - - if ( (ch->style != NULL) && ch->lop_from_style ) { - memcpy(&ch->lop, &ch->style->lop, - sizeof(struct layout_parameters)); - } + int i; + /* Render all subframes */ + for ( i=0; i<fr->num_children; i++ ) { - mtot = ch->lop.margin_l + ch->lop.margin_r; - mtot += fr->lop.pad_l + fr->lop.pad_r; - switch ( ch->lop.w_units ) { + struct frame *ch = fr->children[i]; + double mtot; - case UNITS_SLIDE : - ch->w = ch->lop.w; - break; + if ( (ch->style != NULL) && ch->lop_from_style ) { + memcpy(&ch->lop, &ch->style->lop, + sizeof(struct layout_parameters)); + } - case UNITS_FRAC : - ch->w = fr->w * ch->lop.w - mtot; - break; - } + mtot = ch->lop.margin_l + ch->lop.margin_r; + mtot += fr->lop.pad_l + fr->lop.pad_r; + switch ( ch->lop.w_units ) { - mtot = ch->lop.margin_t + ch->lop.margin_b; - mtot += fr->lop.pad_t + fr->lop.pad_b; - switch ( ch->lop.h_units ) { + case UNITS_SLIDE : + ch->w = ch->lop.w; + break; - case UNITS_SLIDE : - ch->h = ch->lop.h; - break; + case UNITS_FRAC : + ch->w = fr->w * ch->lop.w - mtot; + break; - case UNITS_FRAC : - ch->h = fr->h * ch->lop.h - mtot; - break; + } - } + mtot = ch->lop.margin_t + ch->lop.margin_b; + mtot += fr->lop.pad_t + fr->lop.pad_b; + switch ( ch->lop.h_units ) { - /* Rounding to get bitmap size */ - ch->pix_w = ch->w*scale; - ch->pix_h = ch->h*scale; - render_frame(ch, scale); + case UNITS_SLIDE : + ch->h = ch->lop.h; + break; - ch->x = ch->lop.x + fr->lop.pad_l + ch->lop.margin_l; - ch->y = ch->lop.y + fr->lop.pad_t + ch->lop.margin_t; + case UNITS_FRAC : + ch->h = fr->h * ch->lop.h - mtot; + break; } - } else { + /* Rounding to get bitmap size */ + ch->pix_w = ch->w*scale; + ch->pix_h = ch->h*scale; + render_frame(ch, scale); - render_sc(fr, scale); + ch->x = ch->lop.x + fr->lop.pad_l + ch->lop.margin_l; + ch->y = ch->lop.y + fr->lop.pad_t + ch->lop.margin_t; } + render_sc(fr, scale); + return 0; } @@ -435,29 +429,6 @@ static void composite_slide(struct slide *s, cairo_t *cr, double scale) } -static void show_heirarchy(struct frame *fr, const char *t) -{ - int i; - char tn[1024]; - - strcpy(tn, t); - strcat(tn, " |-> "); - - printf("%s%p %s (%i x %i) / (%.2f x %.2f)\n", t, fr, fr->sc, - fr->pix_w, fr->pix_h, fr->w, fr->h); - - for ( i=0; i<fr->num_children; i++ ) { - if ( fr->children[i] != fr ) { - show_heirarchy(fr->children[i], tn); - } else { - printf("%s<this frame>\n", tn); - } - } - -} - - - /** * render_slide: * @s: A slide. |