From 882c3df54db95c6680bc484b8e605933935d105c Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Sun, 28 Jan 2024 07:36:26 +0800 Subject: [PATCH] topCell blanksAtStart bug fix --- Meter.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Meter.c b/Meter.c index 27bf161c6..2ea7e3b79 100644 --- a/Meter.c +++ b/Meter.c @@ -520,7 +520,7 @@ static uint16_t GraphMeterMode_makeDetailsMask(const GraphColorComputeState* pre uint8_t blanksAtStart; if (prev->nCellsPainted > 0) { - blanksAtStart = (uint8_t)maxBlanks % 8 - blanksAtEnd; + blanksAtStart = ((unsigned int)(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 @@ -773,8 +773,13 @@ static void GraphMeterMode_computeColors(Meter* this, const GraphDrawContext* co } // Paint cells to the buffer - if (hasPartialTopCell && prev.nItemsPainted == topCellItem) - rem = area - (int)area; + if (hasPartialTopCell && prev.nItemsPainted == topCellItem) { + rem = area; + if (nCells == 1 && rem > topCellArea) { + rem = topCellArea; + } + rem -= (int)rem; + } if (nCells > 0 && new.nCellsPainted <= nCellsToPaint) { double prevTopPoint = (prev.valueSum / scaledTotal) * (double)(int)graphHeight;