diff --git a/src/conky.c b/src/conky.c index ed2a26b6..53e9d6d6 100644 --- a/src/conky.c +++ b/src/conky.c @@ -3050,11 +3050,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) cur_x + i + 1, by + h, cur_x + i + 1, round_to_int((double)by + h - specials[special_index].graph[j] * (h - 1) / specials[special_index].graph_scale)); - if ((w - i) / ((float) (w - 2) / - (specials[special_index].graph_width)) > j - && j < MAX_GRAPH_DEPTH - 3) { - j++; - } + ++j; } if (tmpcolour) free(tmpcolour); if (h > cur_y_add diff --git a/src/specials.c b/src/specials.c index 89b1586d..4aec9fdd 100644 --- a/src/specials.c +++ b/src/specials.c @@ -364,7 +364,7 @@ static void graph_append(struct special_t *graph, double f, char showaslog) } /* shift all the data by 1 */ - for (i = graph->graph_width - 1; i > 0; i--) { + for (i = graph->width - 1; i > 0; i--) { graph->graph[i] = graph->graph[i - 1]; if (graph->scaled && graph->graph[i - 1] > graph->graph_scale) { /* check if we need to update the scale */ @@ -393,14 +393,8 @@ void new_graph(struct text_object *obj, char *buf, int buf_max_size, double val) s->width = g->width; if (s->graph == NULL) { - if (s->width > 0 && s->width < MAX_GRAPH_DEPTH) { - // subtract 2 for the box - s->graph_width = s->width /* - 2 */; - } else { - s->graph_width = MAX_GRAPH_DEPTH - 2; - } - s->graph = malloc(s->graph_width * sizeof(double)); - memset(s->graph, 0, s->graph_width * sizeof(double)); + s->graph = malloc(s->width * sizeof(double)); + memset(s->graph, 0, s->width * sizeof(double)); s->graph_scale = 100; } s->height = g->height; @@ -416,9 +410,6 @@ void new_graph(struct text_object *obj, char *buf, int buf_max_size, double val) s->show_scale = 1; } s->tempgrad = g->tempgrad; - /* if (s->width) { - s->graph_width = s->width - 2; // subtract 2 for rectangle around - } */ #ifdef MATH if (g->showaslog) { s->graph_scale = log10(s->graph_scale + 1); diff --git a/src/specials.h b/src/specials.h index 985638aa..0ae6dd18 100644 --- a/src/specials.h +++ b/src/specials.h @@ -33,8 +33,6 @@ #define SPECIAL_CHAR '\x01' -#define MAX_GRAPH_DEPTH 512 - // don't use spaces in LOGGRAPH or NORMGRAPH if you change them #define LOGGRAPH "-l" #define TEMPGRAD "-t" @@ -66,7 +64,6 @@ struct special_t { double *graph; double graph_scale; short show_scale; - int graph_width; int scaled; unsigned long first_colour; // for graph gradient unsigned long last_colour;