X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcairo.c;h=122d1b786f2a28430380e7220b399d0fd5822540;hb=c44153d4b047bc82852df1e5a08e099ab09b14e6;hp=a962deb7acbfe49b6f2c699398ddb4b13fce31d6;hpb=2dd71d2858a845fe8b10d7b279cb7c7e43c9ca16;p=pspp diff --git a/src/output/cairo.c b/src/output/cairo.c index a962deb7ac..122d1b786f 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -25,11 +25,13 @@ #include "libpspp/str.h" #include "libpspp/string-map.h" #include "libpspp/version.h" +#include "data/file-handle-def.h" #include "output/cairo-chart.h" #include "output/chart-item-provider.h" #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" @@ -474,24 +476,30 @@ xr_create (const char *file_name, enum settings_output_devices device_type, } static struct output_driver * -xr_pdf_create (const char *file_name, enum settings_output_devices device_type, +xr_pdf_create (struct file_handle *fh, enum settings_output_devices device_type, struct string_map *o) { - return xr_create (file_name, device_type, o, XR_PDF); + struct output_driver *od = xr_create (fh_get_file_name (fh), device_type, o, XR_PDF); + fh_unref (fh); + return od ; } static struct output_driver * -xr_ps_create (const char *file_name, enum settings_output_devices device_type, +xr_ps_create (struct file_handle *fh, enum settings_output_devices device_type, struct string_map *o) { - return xr_create (file_name, device_type, o, XR_PS); + struct output_driver *od = xr_create (fh_get_file_name (fh), device_type, o, XR_PS); + fh_unref (fh); + return od ; } static struct output_driver * -xr_svg_create (const char *file_name, enum settings_output_devices device_type, +xr_svg_create (struct file_handle *fh, enum settings_output_devices device_type, struct string_map *o) { - return xr_create (file_name, device_type, o, XR_SVG); + struct output_driver *od = xr_create (fh_get_file_name (fh), device_type, o, XR_SVG); + fh_unref (fh); + return od ; } static void @@ -841,8 +849,6 @@ xr_measure_cell_height (void *xr_, const struct table_cell *cell, bb[H][0] = 0; bb[H][1] = width - xr->cell_margin * 2; - if (bb[H][1] <= 0) - return 0; bb[V][0] = 0; bb[V][1] = INT_MAX; clip[H][0] = clip[H][1] = clip[V][0] = clip[V][1] = 0; @@ -1370,11 +1376,9 @@ xr_rendering_measure (struct xr_rendering *r, int *w, int *h) static void xr_draw_chart (const struct chart_item *, cairo_t *, double x, double y, double width, double height); -/* Draws onto CR at least the region of R that is enclosed in (X,Y)-(X+W,Y+H), - and possibly some additional parts. */ +/* Draws onto CR */ void -xr_rendering_draw (struct xr_rendering *r, cairo_t *cr, - int x, int y, int w, int h) +xr_rendering_draw_all (struct xr_rendering *r, cairo_t *cr) { if (is_table_item (r->item)) { @@ -1382,10 +1386,8 @@ xr_rendering_draw (struct xr_rendering *r, cairo_t *cr, xr_set_cairo (xr, cr); - xr->y = 0; - render_pager_draw_region (r->p, - x * XR_POINT, y * XR_POINT, - w * XR_POINT, h * XR_POINT); + render_pager_draw (r->p); + } else xr_draw_chart (to_chart_item (r->item), cr, @@ -1410,6 +1412,8 @@ 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))