summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Budziszewski <christoph@budziszewski.de>2020-06-12 23:53:05 +0200
committerChristoph Budziszewski <christoph@budziszewski.de>2020-06-12 23:53:05 +0200
commitb55f9320bc40a465cd33ddbf6e8c9b7223ae538d (patch)
tree7e3dba2009504b206ad356b5dbc97c58f72e9b80
parent7fdd8d3732354b3fcca2d0430731e8e33345ddda (diff)
fixed x/y coordinate mixup
-rw-r--r--CPUMeter.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/CPUMeter.c b/CPUMeter.c
index 9c63f41e..99be44f8 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -221,10 +221,11 @@ static void MultiColCPUsMeter_draw(Meter* this, int x, int y, int w){
int ncol = MapClassnameToColumncount(this);
int colwidth = (w-ncol)/ncol + 1;
int diff = (w - (colwidth * ncol));
+ int nrows = (count + ncol - 1) / ncol;
for (int i = 0; i < count; i++){
- int d = (i%ncol) > diff ? diff : (i % ncol) ; // dynamic spacer
- int xpos = x + ((i % ncol) * colwidth) + d;
- int ypos = y + ((i / ncol) * meters[0]->h);
+ int d = (i/nrows) > diff ? diff : (i / nrows) ; // dynamic spacer
+ int xpos = x + ((i / nrows) * colwidth) + d;
+ int ypos = y + ((i % nrows) * meters[0]->h);
meters[i]->draw(meters[i], xpos, ypos, colwidth);
}
}

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