cosmetic fix for line drawing in graphs

When drawing graphs in line mode and growing right, instead of filling
in the last pixel (as the comments indicate is the intention), a line is
drawn to what is actually the first y value in the graph.  This is
because the index variable has already been incremented.  To fix it,
decrement it (correcting for modulus).  Patch attached.  Note I didn't
try it, since i am too lazy to update all the xcb stuff, but made sure
the patch goes cleanly against current head.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Matus Telgarsky 2009-04-28 17:47:41 -07:00 committed by Julien Danjou
parent ff8c2fe460
commit 30821f80a9
1 changed files with 1 additions and 1 deletions

2
draw.c
View File

@ -544,7 +544,7 @@ draw_graph_line(draw_context_t *ctx, area_t rect, int *to, int cur_index,
/* onto the right border: fills a pixel also when there's only one value */ /* onto the right border: fills a pixel also when there's only one value */
if(grow == Right) if(grow == Right)
cairo_line_to(ctx->cr, x, y - to[cur_index]); cairo_line_to(ctx->cr, x, y - to[(cur_index + (w - 1)) % w]);
cairo_stroke(ctx->cr); cairo_stroke(ctx->cr);