X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Frender.c;h=c178839a0bfd1d7f79348f371b4d15cead9b3daf;hb=refs%2Fbuilds%2F20131105032650%2Fpspp;hp=6722a13dc2e1100a99fc0f3d8b971a14150e665e;hpb=39dd3acbc5fddf1765dec221124c1709613bdf36;p=pspp diff --git a/src/output/render.c b/src/output/render.c index 6722a13dc2..c178839a0b 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 @@ -384,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; } } @@ -455,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. */ @@ -466,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; } @@ -814,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]) { @@ -957,69 +958,6 @@ render_page_draw (const struct render_page *page) render_page_draw_cells (page, bb); } -/* Returns the greatest value i, 0 <= i < n, such that cp[i] <= x0. */ -static int -get_clip_min_extent (int x0, const int cp[], int n) -{ - int low, high, best; - - low = 0; - high = n; - best = 0; - while (low < high) - { - int middle = low + (high - low) / 2; - - if (cp[middle] <= x0) - { - best = middle; - low = middle + 1; - } - else - high = middle; - } - - return best; -} - -/* Returns the least value i, 0 <= i < n, such that cp[i + 1] >= x1. */ -static int -get_clip_max_extent (int x1, const int cp[], int n) -{ - int low, high, best; - - low = 0; - high = n; - best = n; - while (low < high) - { - int middle = low + (high - low) / 2; - - if (cp[middle] >= x1) - best = high = middle; - else - low = middle + 1; - } - - return best; -} - -/* Renders the cells of PAGE that intersect (X,Y)-(X+W,Y+H), by calling the - 'draw_line' and 'draw_cell' functions from the render_params provided to - render_page_create(). */ -void -render_page_draw_region (const struct render_page *page, - int x, int y, int w, int h) -{ - int bb[TABLE_N_AXES][2]; - - bb[H][0] = get_clip_min_extent (x, page->cp[H], page->n[H] * 2 + 1); - bb[H][1] = get_clip_max_extent (x + w, page->cp[H], page->n[H] * 2 + 1); - bb[V][0] = get_clip_min_extent (y, page->cp[V], page->n[V] * 2 + 1); - bb[V][1] = get_clip_max_extent (y + h, page->cp[V], page->n[V] * 2 + 1); - - render_page_draw_cells (page, bb); -} /* Breaking up tables to fit on a page. */