mirror of https://github.com/xzeldon/htop.git
Merge pull request #651 from Explorer09/graph-mode-draw
Round values in graph drawing (instead of implicit truncate)
This commit is contained in:
commit
821d50f0b4
4
Meter.c
4
Meter.c
|
@ -406,8 +406,8 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
}
|
}
|
||||||
for (; i < nValues; i+=2, k++) {
|
for (; i < nValues; i+=2, k++) {
|
||||||
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
||||||
int v1 = CLAMP(data->values[i] * pix, 1, pix);
|
int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix);
|
||||||
int v2 = CLAMP(data->values[i+1] * pix, 1, pix);
|
int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix);
|
||||||
|
|
||||||
int colorIdx = GRAPH_1;
|
int colorIdx = GRAPH_1;
|
||||||
for (int line = 0; line < GRAPH_HEIGHT; line++) {
|
for (int line = 0; line < GRAPH_HEIGHT; line++) {
|
||||||
|
|
Loading…
Reference in New Issue