Skip to content

Commit

Permalink
lookupCell() one item blanksAtEnd code (1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Mar 23, 2024
1 parent b9a075a commit dab9a52
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,16 +1046,17 @@ static int GraphMeterMode_lookupCell(const Meter* this, const GraphDrawContext*
// Scale according to exponent difference. Round up.
numDots = deltaExp < UINT16_WIDTH ? ((numDots - 1) >> deltaExp) : 0;
numDots++;
unsigned int blanksAtEnd = graphHeight * 8 - numDots;

if (y > (numDots - 1) / 8)
if (graphHeight - 1 - y < blanksAtEnd / 8)
goto cellIsEmpty;

itemIndex = 0;
*details = 0xFF;
if (y == (numDots - 1) / 8) {
if (graphHeight - 1 - y == blanksAtEnd / 8) {
const uint8_t dotAlignment = 2;
unsigned int blanksAtTopCell = (8 - 1 - (numDots - 1) % 8) / dotAlignment * dotAlignment;
*details <<= blanksAtTopCell;
blanksAtEnd = (blanksAtEnd % 8) / dotAlignment * dotAlignment;
*details <<= blanksAtEnd;
}
} else {
int deltaExpArg = deltaExp >= UINT16_WIDTH ? UINT16_WIDTH - 1 : deltaExp;
Expand Down

0 comments on commit dab9a52

Please sign in to comment.