From fb69111748d9d4eba92024799421ee2573418d15 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 27 Dec 2014 21:27:00 +0000 Subject: Add new boxes where necessary (!) --- src/shape.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src') diff --git a/src/shape.c b/src/shape.c index 97178a1..ab5199b 100644 --- a/src/shape.c +++ b/src/shape.c @@ -131,11 +131,42 @@ static int add_wrap_boxes(struct wrap_line *line, const char *text, } +void add_surface_box(struct wrap_line *line, cairo_surface_t *surf, + double w, double h) +{ + struct wrap_box *box; + + if ( line->n_boxes == line->max_boxes ) { + line->max_boxes += 32; + alloc_boxes(line); + if ( line->n_boxes == line->max_boxes ) return; + } + box = &line->boxes[line->n_boxes]; + + box->type = WRAP_BOX_SURFACE; + box->scblock = NULL; + box->offs_char = 0; + box->space = WRAP_SPACE_NONE; + box->width = pango_units_from_double(w); + box->ascent = pango_units_from_double(h); + box->height = pango_units_from_double(h); + box->surf = surf; + box->editable = 0; + line->n_boxes++; +} + + void add_image_box(struct wrap_line *line, const char *filename, int w, int h, int editable) { struct wrap_box *box; + if ( line->n_boxes == line->max_boxes ) { + line->max_boxes += 32; + alloc_boxes(line); + if ( line->n_boxes == line->max_boxes ) return; + } + box = &line->boxes[line->n_boxes]; box->type = WRAP_BOX_IMAGE; box->scblock = NULL; -- cgit v1.2.3