From 62ac0903685961643ba6f5d9caa2ec3f99ce1545 Mon Sep 17 00:00:00 2001 From: marco candrian Date: Sat, 12 Apr 2008 06:56:14 +0000 Subject: [PATCH] [common/draw] curious (cairo?) bug, sometimes draws the line 1 pixel to much on the right happens only when creating a gradient, and not always, and adding + 1 (creating a slightly diagonal gradient), seems to help a little bit). --- common/draw.c | 10 ++++++---- widgets/graph.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/draw.c b/common/draw.c index 916b9c3aa..b7f4d6dda 100644 --- a/common/draw.c +++ b/common/draw.c @@ -307,10 +307,12 @@ draw_setup_cairo_color_source(DrawCtx *ctx, area_t rect, cairo_set_source_rgb(ctx->cr, pcolor->red / 65535.0, pcolor->green / 65535.0, pcolor->blue / 65535.0); else { - pat = cairo_pattern_create_linear(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height); + /* rext.x + 1 -> else will draw 1 pixel too much to the right or + * similar - cairo bug? */ + pat = cairo_pattern_create_linear(rect.x - 1, rect.y, rect.x + 1 + rect.width, rect.y + rect.height); /* pcolor is always set (so far in awesome) */ - cairo_pattern_add_color_stop_rgb(pat, 0, pcolor->red / 65535.0, + cairo_pattern_add_color_stop_rgb(pat, 0.0, pcolor->red / 65535.0, pcolor->green / 65535.0, pcolor->blue / 65535.0); if(pcolor_center) @@ -318,10 +320,10 @@ draw_setup_cairo_color_source(DrawCtx *ctx, area_t rect, pcolor_center->green / 65535.0, pcolor_center->blue / 65535.0); if(pcolor_end) - cairo_pattern_add_color_stop_rgb(pat, 1, pcolor_end->red / 65535.0, + cairo_pattern_add_color_stop_rgb(pat, 1.0, pcolor_end->red / 65535.0, pcolor_end->green / 65535.0, pcolor_end->blue / 65535.0); else - cairo_pattern_add_color_stop_rgb(pat, 1, pcolor->red / 65535.0, + cairo_pattern_add_color_stop_rgb(pat, 1.0, pcolor->red / 65535.0, pcolor->green / 65535.0, pcolor->blue / 65535.0); cairo_set_source(ctx->cr, pat); } diff --git a/widgets/graph.c b/widgets/graph.c index cbf7a4601..45cde9125 100644 --- a/widgets/graph.c +++ b/widgets/graph.c @@ -115,11 +115,11 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset, rectangle.x++; rectangle.y++; rectangle.width = d->size; - rectangle.height -= 2; + rectangle.height = d->box_height; draw_rectangle(ctx, rectangle, 1.0, True, d->bg); /* for graph drawing */ - rectangle.x = widget->area.x + 2; + rectangle.x++; /* I won't know why */ rectangle.y = margin_top + d->box_height + 1; /* bottom left corner as starting point */ rectangle.width = d->size; /* rectangle.height is not used */