[widgets/graph] offset fixed now.
In fact on my pc, when there is no fg_end or fg_center defined, it draws it one pixel too much on the right. On Gigamo's PC, that patch should work on any case. It also 'should' work from what I guess! For people having a problem, they could define fg_end to the same as fg. Or when it's really serious (on not just here), that could be done inside awesome. (Finally somekind of little cairo bug, from my perspektive)
This commit is contained in:
parent
8277693ab4
commit
bc7d9211ba
|
@ -501,20 +501,23 @@ draw_graph_line(DrawCtx *ctx, area_t rect, int *to, int cur_index,
|
|||
y = rect.y;
|
||||
w = rect.width;
|
||||
|
||||
/* NOTE: think about about the cairo coordinates pointing to the upper left
|
||||
* corner of a single pixel (what itself is a square) - and it draws from
|
||||
* there! It fills the pixels placed on the bottom/right of that, or so */
|
||||
|
||||
if(grow == Right) /* draw from right to left */
|
||||
{
|
||||
x += w - 1;
|
||||
x += w;
|
||||
|
||||
/* initial point */
|
||||
cairo_move_to(ctx->cr, x, y - to[cur_index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* x-1 (on the border), paints *from* the last point (... not included itself) */
|
||||
/* may makes sense when you assume there is already some line drawn to it - anyway */
|
||||
cairo_move_to(ctx->cr, x - 1, y - to[cur_index]);
|
||||
}
|
||||
|
||||
for(i = 0; i < w; i++)
|
||||
{
|
||||
if(grow == Right)
|
||||
x--;
|
||||
else
|
||||
x++;
|
||||
|
||||
if (to[cur_index] > 0)
|
||||
{
|
||||
cairo_line_to(ctx->cr, x, y - to[cur_index]);
|
||||
|
@ -534,11 +537,8 @@ draw_graph_line(DrawCtx *ctx, area_t rect, int *to, int cur_index,
|
|||
if (--cur_index < 0) /* cycles around the index */
|
||||
cur_index = w - 1;
|
||||
|
||||
if(grow == Right)
|
||||
x--;
|
||||
else
|
||||
x++;
|
||||
}
|
||||
|
||||
cairo_stroke(ctx->cr);
|
||||
|
||||
if(pat)
|
||||
|
|
|
@ -119,7 +119,6 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset,
|
|||
draw_rectangle(ctx, rectangle, 1.0, True, d->bg);
|
||||
|
||||
/* for graph drawing */
|
||||
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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue