X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Frender.c;h=a91e1f7b799570aa4a29689b984fdf17af33758c;hb=3c5630105991133a09971a4c107141767a2c7d0c;hp=094e68799cf93b7e72be846075f8e04da80ec499;hpb=97f9b8ad137e333af9b3c767556d28dfda93a461;p=pspp diff --git a/src/output/render.c b/src/output/render.c index 094e68799c..a91e1f7b79 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011, 2013 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 @@ -359,9 +359,14 @@ distribute_spanned_width (int width, w1 by the common denominator of all three calculations (d), dividing that out in the column width calculation, and then keeping the remainder for the next iteration. + + (We actually compute the unspanned width of a column as twice the + unspanned width, plus the width of the rule on the left, plus the width of + the rule on the right. That way each rule contributes to both the cell on + its left and on its right.) */ d0 = n; - d1 = total_unspanned * 2.0; + d1 = 2.0 * (total_unspanned > 0 ? total_unspanned : 1.0); d = d0 * d1; if (total_unspanned > 0) d *= 2.0; @@ -379,7 +384,7 @@ distribute_spanned_width (int width, w += width * unspanned * d0; } - rows[x].width = w / d; + rows[x].width = MAX (rows[x].width, w / d); w -= rows[x].width * d; } } @@ -450,7 +455,7 @@ measure_rule (const struct render_params *params, const struct table *table, enum table_axis b = !a; unsigned int rules; int d[TABLE_N_AXES]; - int width, i; + int width; /* Determine all types of rules that are present, as a bitmap in 'rules' where rule type 't' is present if bit 2**t is set. */ @@ -461,10 +466,11 @@ measure_rule (const struct render_params *params, const struct table *table, /* Calculate maximum width of the rules that are present. */ width = 0; - for (i = 0; i < N_LINES; i++) - if (rules & (1u << i)) - width = MAX (width, params->line_widths[a][rule_to_render_type (i)]); - + if (rules & (1u << TAL_1) + || (z > 0 && z < table->n[a] && rules & (1u << TAL_GAP))) + width = params->line_widths[a][RENDER_LINE_SINGLE]; + if (rules & (1u << TAL_2)) + width = MAX (width, params->line_widths[a][RENDER_LINE_DOUBLE]); return width; } @@ -809,7 +815,7 @@ render_page_get_size (const struct render_page *page, enum table_axis axis) /* Drawing render_pages. */ -static enum render_line_style +static inline enum render_line_style get_rule (const struct render_page *page, enum table_axis axis, const int d[TABLE_N_AXES]) {