output: Add support for alternating row colors.
[pspp] / src / output / render.c
index eb5f1cfe1aa213d1da56221fcc17e652e9fcf45c..23ef9927275be3f119077075d46e98efcc078dff 100644 (file)
@@ -1028,7 +1028,12 @@ render_cell (const struct render_page *page, const int ofs[TABLE_N_AXES],
       spill[axis][1] = rule_width (page, axis, cell->d[axis][1]) / 2;
     }
 
-  page->params->draw_cell (page->params->aux, cell, bb, spill, clip);
+  int color_idx = (cell->d[V][0] < page->h[V][0]
+                   || page->n[V] - (cell->d[V][0] + 1) < page->h[V][1]
+                   ? 0
+                   : (cell->d[V][0] - page->h[V][0]) & 1);
+  page->params->draw_cell (page->params->aux, cell, color_idx,
+                           bb, spill, clip);
 }
 
 /* Draws the cells of PAGE indicated in BB. */