From 845d4b4f3fb5fdd7af9272c40f2c2987d859c2aa Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 26 Oct 2010 21:56:37 -0700 Subject: [PATCH] cairo: Draw table titles in xr_rendering_draw() too. xr_rendering_draw() didn't draw table titles. It seems that this was just an oversight, so this commit fixes the problem. xr_rendering_draw() is used by the GUI output viewer window, so this makes the GUI output viewer display table titles now. Bug #30554. --- src/output/cairo.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/output/cairo.c b/src/output/cairo.c index e15acbb7..276bafe0 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -840,6 +840,20 @@ xr_layout_cell (struct xr_driver *xr, const struct table_cell *cell, *height = h; } } + +static void +xr_draw_title (struct xr_driver *xr, const char *title, int title_height) +{ + struct table_cell cell; + int bb[TABLE_N_AXES][2]; + + xr_init_caption_cell (title, &cell); + bb[H][0] = 0; + bb[H][1] = xr->width; + bb[V][0] = 0; + bb[V][1] = title_height; + xr_draw_cell (xr, &cell, bb, bb); +} struct output_driver_factory pdf_driver_factory = { "pdf", xr_pdf_create }; struct output_driver_factory ps_driver_factory = { "ps", xr_ps_create }; @@ -966,7 +980,15 @@ xr_rendering_draw (struct xr_rendering *r, cairo_t *cr, struct xr_driver *xr = r->xr; xr_set_cairo (xr, cr); - xr->y = 0; + + if (r->title_height > 0) + { + xr->y = 0; + xr_draw_title (xr, table_item_get_caption (to_table_item (r->item)), + r->title_height); + } + + xr->y = r->title_height; render_page_draw_region (r->page, x * 1024, y * 1024, w * 1024, h * 1024); } @@ -1090,18 +1112,9 @@ xr_table_render (struct xr_render_fsm *fsm, struct xr_driver *xr) if (ts->caption_height) { if (xr->cairo) - { - struct table_cell cell; - int bb[TABLE_N_AXES][2]; - - xr_init_caption_cell (table_item_get_caption (ts->table_item), - &cell); - bb[H][0] = 0; - bb[H][1] = xr->width; - bb[V][0] = 0; - bb[V][1] = ts->caption_height; - xr_draw_cell (xr, &cell, bb, bb); - } + xr_draw_title (xr, table_item_get_caption (ts->table_item), + ts->caption_height); + xr->y += ts->caption_height; ts->caption_height = 0; } -- 2.30.2