X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=src%2Foutput%2Fcairo.c;h=4af75caae455f3a5f03f1c687bcfba7efc45c324;hb=2a45a48f87553563cbf0f0b6dcc20396b3e5a27a;hp=fa9b2e18725e89c5f8c6edd9ccf9d7e6ffda8495;hpb=d3fef25674baf4f4e25502f257c680b5090535c6;p=pspp diff --git a/src/output/cairo.c b/src/output/cairo.c index fa9b2e1872..4af75caae4 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,10 +30,12 @@ #include "output/charts/boxplot.h" #include "output/charts/np-plot.h" #include "output/charts/piechart.h" +#include "output/charts/barchart.h" #include "output/charts/plot-hist.h" #include "output/charts/roc-chart.h" #include "output/charts/spreadlevel-plot.h" #include "output/charts/scree.h" +#include "output/charts/scatterplot.h" #include "output/driver-provider.h" #include "output/message-item.h" #include "output/options.h" @@ -286,7 +288,7 @@ apply_options (struct xr_driver *xr, struct string_map *o) xr->fonts[XR_FONT_MARKER].desc = parse_font (d, o, "marker-font", "serif", font_size * PANGO_SCALE_X_SMALL); - xr->line_gutter = 0; + xr->line_gutter = XR_POINT / 2; xr->line_space = XR_POINT; xr->line_width = XR_POINT / 2; xr->page_number = 0; @@ -562,24 +564,19 @@ xr_submit (struct output_driver *driver, const struct output_item *output_item) See the big comment in cairo.h for intended usage. */ -/* Gives new page CAIRO to XR for output. CAIRO may be null to skip actually - rendering the page (which might be useful to find out how many pages an - output document has without actually rendering it). */ +/* Gives new page CAIRO to XR for output. */ void xr_driver_next_page (struct xr_driver *xr, cairo_t *cairo) { - if (cairo != NULL) - { - cairo_save (cairo); - cairo_set_source_rgb (cairo, xr->bg.red, xr->bg.green, xr->bg.blue); - cairo_rectangle (cairo, 0, 0, xr->width, xr->length); - cairo_fill (cairo); - cairo_restore (cairo); - - cairo_translate (cairo, - xr_to_pt (xr->left_margin), - xr_to_pt (xr->top_margin)); - } + cairo_save (cairo); + cairo_set_source_rgb (cairo, xr->bg.red, xr->bg.green, xr->bg.blue); + cairo_rectangle (cairo, 0, 0, xr->width, xr->length); + cairo_fill (cairo); + cairo_restore (cairo); + + cairo_translate (cairo, + xr_to_pt (xr->left_margin), + xr_to_pt (xr->top_margin)); xr->page_number++; xr->cairo = cairo; @@ -1296,7 +1293,8 @@ xr_rendering_create_text (struct xr_driver *xr, const char *text, cairo_t *cr) struct table_item *table_item; struct xr_rendering *r; - table_item = table_item_create (table_from_string (TAB_LEFT, text), NULL); + table_item = table_item_create (table_from_string (TAB_LEFT, text), + NULL, NULL); r = xr_rendering_create (xr, &table_item->output_item, cr); table_item_unref (table_item); @@ -1413,12 +1411,16 @@ xr_draw_chart (const struct chart_item *chart_item, cairo_t *cr, xrchart_draw_np_plot (chart_item, cr, &geom); else if (is_piechart (chart_item)) xrchart_draw_piechart (chart_item, cr, &geom); + else if (is_barchart (chart_item)) + xrchart_draw_barchart (chart_item, cr, &geom); else if (is_roc_chart (chart_item)) xrchart_draw_roc (chart_item, cr, &geom); else if (is_scree (chart_item)) xrchart_draw_scree (chart_item, cr, &geom); else if (is_spreadlevel_plot_chart (chart_item)) xrchart_draw_spreadlevel (chart_item, cr, &geom); + else if (is_scatterplot_chart (chart_item)) + xrchart_draw_scatterplot (chart_item, cr, &geom); else NOT_REACHED (); xrchart_geometry_free (cr, &geom); @@ -1600,7 +1602,8 @@ xr_create_text_renderer (struct xr_driver *xr, const char *text) struct table_item *table_item; struct xr_render_fsm *fsm; - table_item = table_item_create (table_from_string (TAB_LEFT, text), NULL); + table_item = table_item_create (table_from_string (TAB_LEFT, text), + NULL, NULL); fsm = xr_render_table (xr, table_item); table_item_unref (table_item);