graph: draw everything in one loop
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
4b6ba11360
commit
3fa072504f
|
@ -140,11 +140,10 @@ graph_draw(draw_context_t *ctx,
|
|||
int used __attribute__ ((unused)),
|
||||
void *p __attribute__ ((unused)))
|
||||
{
|
||||
int margin_top;
|
||||
int y, tmp, cur_index, test_index;
|
||||
int margin_top, y;
|
||||
graph_data_t *d = w->widget->data;
|
||||
area_t rectangle, pattern_area;
|
||||
graph_t *graph, *graphtmp;
|
||||
graph_t *graph;
|
||||
|
||||
if(!d->graphs)
|
||||
return 0;
|
||||
|
@ -179,13 +178,11 @@ graph_draw(draw_context_t *ctx,
|
|||
else
|
||||
pattern_area.x = rectangle.x;
|
||||
|
||||
pattern_area.y = rectangle.y - rectangle.height;
|
||||
|
||||
for(graph = d->graphs; graph; graph = graph->next)
|
||||
switch(graph->draw_style)
|
||||
{
|
||||
if(graph->draw_style != Top_Style)
|
||||
continue;
|
||||
|
||||
case Top_Style:
|
||||
pattern_area.y = rectangle.y - rectangle.height;
|
||||
if(graph->vertical_gradient)
|
||||
{
|
||||
pattern_area.width = 0;
|
||||
|
@ -209,16 +206,9 @@ graph_draw(draw_context_t *ctx,
|
|||
}
|
||||
draw_graph(ctx, rectangle , d->draw_from, d->draw_to, graph->index, d->grow, pattern_area,
|
||||
&graph->color_start, graph->pcolor_center, graph->pcolor_end);
|
||||
}
|
||||
|
||||
break;
|
||||
case Bottom_Style:
|
||||
pattern_area.y = rectangle.y;
|
||||
|
||||
/* draw style = bottom */
|
||||
for(graph = d->graphs; graph; graph = graph->next)
|
||||
{
|
||||
if(graph->draw_style != Bottom_Style)
|
||||
continue;
|
||||
|
||||
if(graph->vertical_gradient)
|
||||
{
|
||||
pattern_area.width = 0;
|
||||
|
@ -237,14 +227,9 @@ graph_draw(draw_context_t *ctx,
|
|||
p_clear(d->draw_from, d->size);
|
||||
draw_graph(ctx, rectangle, d->draw_from, graph->lines, graph->index, d->grow, pattern_area,
|
||||
&graph->color_start, graph->pcolor_center, graph->pcolor_end);
|
||||
}
|
||||
|
||||
/* draw style = line */
|
||||
for(graph = d->graphs; graph; graph = graph->next)
|
||||
{
|
||||
if(graph->draw_style != Line_Style)
|
||||
continue;
|
||||
|
||||
break;
|
||||
case Line_Style:
|
||||
pattern_area.y = rectangle.y;
|
||||
if(graph->vertical_gradient)
|
||||
{
|
||||
pattern_area.width = 0;
|
||||
|
@ -261,6 +246,7 @@ graph_draw(draw_context_t *ctx,
|
|||
|
||||
draw_graph_line(ctx, rectangle, graph->lines, graph->index, d->grow, pattern_area,
|
||||
&graph->color_start, graph->pcolor_center, graph->pcolor_end);
|
||||
break;
|
||||
}
|
||||
|
||||
/* draw border (after line-drawing, what paints 0-values to the border) */
|
||||
|
|
Loading…
Reference in New Issue