summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-07-26 16:15:59 -0300
committerGitHub <noreply@github.com>2017-07-26 16:15:59 -0300
commit821d50f0b49237052c988f4170737ebce17f33d6 (patch)
tree24862245d03ad151cb730d7edbe886752763dfde
parentef7817c17a35dd5f8d9eb9ee65539e52d2fdb410 (diff)
parent143a7de6b222652455fbe7956414afcda151d634 (diff)
Merge pull request #651 from Explorer09/graph-mode-draw
Round values in graph drawing (instead of implicit truncate)
-rw-r--r--Meter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Meter.c b/Meter.c
index 706196dd..8a18d86c 100644
--- a/Meter.c
+++ b/Meter.c
@@ -406,8 +406,8 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
}
for (; i < nValues; i+=2, k++) {
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
- int v1 = CLAMP(data->values[i] * pix, 1, pix);
- int v2 = CLAMP(data->values[i+1] * pix, 1, pix);
+ int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix);
+ int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix);
int colorIdx = GRAPH_1;
for (int line = 0; line < GRAPH_HEIGHT; line++) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy