1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +00:00

Fix graph updating for large (>512pix) graphs (sf.net #3253656)

apparently, this was actually a feature as someone made it deliberately act that way. However, I
agree with the bug reporter that it is strange so I remove it.
This commit is contained in:
Pavel Labath 2011-10-23 20:51:55 +02:00
parent 152cdb4cc3
commit 1248fd2139
3 changed files with 4 additions and 20 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;