summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2016-07-22 12:44:16 +0800
committerExplorer09 <explorer09@gmail.com>2017-07-15 22:14:44 +0800
commit143a7de6b222652455fbe7956414afcda151d634 (patch)
tree903f14caebe9ffc7c0bf04c1a8c7888934c06a9a
parent71785e2ded88f25370b24b06978a78f4fd2ba524 (diff)
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 dbfa7d7f..549bb57d 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