X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcairo.c;h=ef0b593233e67f7e03867926d35753536314166f;hb=38f1759deae638712ed86675914c123ffb04f5ba;hp=122d1b786f2a28430380e7220b399d0fd5822540;hpb=d6cbbc8d634fa91f050661355139a4e4697e99ab;p=pspp diff --git a/src/output/cairo.c b/src/output/cairo.c index 122d1b786f..ef0b593233 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, 2015 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 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 @@ -711,9 +711,9 @@ xr_draw_line (void *xr_, int bb[TABLE_N_AXES][2], const int x3 = bb[H][1]; const int y3 = bb[V][1]; const int top = styles[H][0]; - const int left = styles[V][0]; const int bottom = styles[H][1]; - const int right = styles[V][1]; + const int start_of_line = render_direction_rtl() ? styles[V][1]: styles[V][0]; + const int end_of_line = render_direction_rtl() ? styles[V][0]: styles[V][1]; /* The algorithm here is somewhat subtle, to allow it to handle all the kinds of intersections that we need. @@ -753,7 +753,7 @@ xr_draw_line (void *xr_, int bb[TABLE_N_AXES][2], (It doesn't make sense to have different kinds of line on the same axis, so we don't try to gracefully handle that case.) */ bool double_vert = top == RENDER_LINE_DOUBLE || bottom == RENDER_LINE_DOUBLE; - bool double_horz = left == RENDER_LINE_DOUBLE || right == RENDER_LINE_DOUBLE; + bool double_horz = start_of_line == RENDER_LINE_DOUBLE || end_of_line == RENDER_LINE_DOUBLE; /* When horizontal lines are doubled, the left-side line along y1 normally runs from x0 to x2, @@ -788,8 +788,8 @@ xr_draw_line (void *xr_, int bb[TABLE_N_AXES][2], int x1 = xc - horz_line_ofs; int x2 = xc + horz_line_ofs; - bool shorten_x1_lines = left == RENDER_LINE_DOUBLE; - bool shorten_x2_lines = right == RENDER_LINE_DOUBLE; + bool shorten_x1_lines = start_of_line == RENDER_LINE_DOUBLE; + bool shorten_x2_lines = end_of_line == RENDER_LINE_DOUBLE; bool shorten_xc_line = shorten_x1_lines && shorten_x2_lines; int vert_line_ofs = double_horz ? double_line_ofs : 0; int yc = (y0 + y3) / 2; @@ -797,11 +797,11 @@ xr_draw_line (void *xr_, int bb[TABLE_N_AXES][2], int y2 = yc + vert_line_ofs; if (!double_horz) - horz_line (xr, x0, x1, x2, x3, yc, left, right, shorten_yc_line); + horz_line (xr, x0, x1, x2, x3, yc, start_of_line, end_of_line, shorten_yc_line); else { - horz_line (xr, x0, x1, x2, x3, y1, left, right, shorten_y1_lines); - horz_line (xr, x0, x1, x2, x3, y2, left, right, shorten_y2_lines); + horz_line (xr, x0, x1, x2, x3, y1, start_of_line, end_of_line, shorten_y1_lines); + horz_line (xr, x0, x1, x2, x3, y2, start_of_line, end_of_line, shorten_y2_lines); } if (!double_vert) @@ -1078,12 +1078,14 @@ xr_layout_cell_text (struct xr_driver *xr, { if (brk && clip[H][0] != clip[H][1]) best = bottom; - *brk = bottom; + if (brk) + *brk = bottom; } else break; } while (pango_layout_iter_next_line (iter)); + pango_layout_iter_free (iter); /* If enabled, draws a green line across the chosen breakpoint, which can be useful for debugging issues with breaking. */ @@ -1306,7 +1308,7 @@ xr_rendering_create_text (struct xr_driver *xr, const char *text, cairo_t *cr) return r; } -void +void xr_rendering_apply_options (struct xr_rendering *xr, struct string_map *o) { if (is_table_item (xr->item)) @@ -1540,13 +1542,20 @@ xr_chart_render (struct xr_render_fsm *fsm, struct xr_driver *xr) { struct xr_chart_state *cs = UP_CAST (fsm, struct xr_chart_state, fsm); - if (xr->y > 0) + const int chart_height = 0.8 * (xr->length < xr->width ? xr->length : xr->width); + + if (xr->y > xr->length - chart_height) return true; if (xr->cairo != NULL) - xr_draw_chart (cs->chart_item, xr->cairo, 0.0, 0.0, - xr_to_pt (xr->width), xr_to_pt (xr->length)); - xr->y = xr->length; + { + xr_draw_chart (cs->chart_item, xr->cairo, + 0.0, + xr_to_pt (xr->y), + xr_to_pt (xr->width), + xr_to_pt (chart_height)); + } + xr->y += chart_height; return false; }