From 30821f80a90d7dfd07e9df750d3abb300cd88f15 Mon Sep 17 00:00:00 2001 From: Matus Telgarsky Date: Tue, 28 Apr 2009 17:47:41 -0700 Subject: [PATCH] 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 --- draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/draw.c b/draw.c index 5d397149..57823bc9 100644 --- a/draw.c +++ b/draw.c @@ -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 */ 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);