Skip to content

Commit

Permalink
makeDetailsMask() maxBlanks uint8_t (p6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Feb 11, 2024
1 parent 46b40a1 commit 1f4ea10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static uint16_t GraphMeterMode_makeDetailsMask(const GraphColorComputeState* pre
assert(rem < 1.0);

double numDots = ceil(rem * 8.0);
double maxBlanks = 8.0 - numDots;
uint8_t maxBlanks = 8 - (uint8_t)numDots;

uint8_t blanksAtEnd;
bool roundsUpInAscii = false;
Expand All @@ -514,7 +514,7 @@ static uint16_t GraphMeterMode_makeDetailsMask(const GraphColorComputeState* pre
blanksAtEnd = (uint8_t)blanksAtTopCell;
roundsUpInAscii = true;
} else if (prev->nCellsPainted == 0 || prev->topPoint <= (double)(int)prev->nCellsPainted) {
blanksAtEnd = (uint8_t)maxBlanks % 8;
blanksAtEnd = maxBlanks % 8;
} else if ((double)(int)new->nCellsPainted > new->topPoint) {
assert((int)new->nCellsPainted - new->topPoint < 1.0);
// Unlike other conditions, this one rounds to nearest for visual reason.
Expand All @@ -538,7 +538,7 @@ static uint16_t GraphMeterMode_makeDetailsMask(const GraphColorComputeState* pre

uint8_t blanksAtStart;
if (prev->nCellsPainted > 0) {
blanksAtStart = (uint8_t)((int)maxBlanks - blanksAtEnd) % 8;
blanksAtStart = (uint8_t)(maxBlanks - blanksAtEnd) % 8;
} else {
// Always zero blanks for the first cell.
// When an item would be painted with all cells (from the first cell to
Expand Down

0 comments on commit 1f4ea10

Please sign in to comment.