aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2014-12-27 21:27:00 +0000
committerThomas White <taw@bitwiz.org.uk>2014-12-27 21:27:00 +0000
commitfb69111748d9d4eba92024799421ee2573418d15 (patch)
treed90e721ed6d90527412aadf9805a09afe77b1677
parent58c55a0f038c95a7245fd58dc66b494c5b666a7e (diff)
Add new boxes where necessary (!)
-rw-r--r--src/shape.c31
1 files changed, 31 insertions, 0 deletions
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;