Skip to content

Commit

Permalink
makeDetailsMask() maxBlanks uint8_t (p14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Feb 13, 2024
1 parent b19a5c5 commit 7b003e9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ 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 blanksAtEnd;
bool roundsUpInAscii = false;
Expand All @@ -514,7 +513,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 = (uint8_t)(8 - (uint8_t)numDots) % 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 +537,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)(8 - (uint8_t)numDots - 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 7b003e9

Please sign in to comment.