Skip to content

Commit

Permalink
computeColors() numDots arg in unsigned int
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Feb 5, 2024
1 parent c797654 commit 1649731
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,20 +589,20 @@ static void GraphMeterMode_paintCellsForItem(GraphColorCell* cellsStart, unsigne
}
}

static void GraphMeterMode_computeColors(Meter* this, const GraphDrawContext* context, GraphColorCell* valueStart, int deltaExp, double scaledTotal, int numDots) {
static void GraphMeterMode_computeColors(Meter* this, const GraphDrawContext* context, GraphColorCell* valueStart, int deltaExp, double scaledTotal, unsigned int numDots) {
unsigned int graphHeight = this->drawData.graphHeight;
bool isPercentChart = context->isPercentChart;

assert(deltaExp >= 0);
assert(numDots > 0 && numDots <= (int)graphHeight * 8);
assert(numDots > 0 && numDots <= graphHeight * 8);

unsigned int increment;
size_t firstCellIndex = GraphMeterMode_valueCellIndex(graphHeight, isPercentChart, deltaExp, 0, NULL, &increment);
assert(firstCellIndex < context->nCellsPerValue);

unsigned int topCell = ((unsigned int)numDots - 1) / 8;
unsigned int topCell = (numDots - 1) / 8;
const uint8_t dotAlignment = 2;
unsigned int blanksAtTopCell = ((topCell + 1) * 8 - (unsigned int)numDots) / dotAlignment * dotAlignment;
unsigned int blanksAtTopCell = ((topCell + 1) * 8 - numDots) / dotAlignment * dotAlignment;

bool hasPartialTopCell = false;
if (blanksAtTopCell > 0) {
Expand Down Expand Up @@ -916,7 +916,7 @@ static void GraphMeterMode_recordNewValue(Meter* this, const GraphDrawContext* c
numDots = 1; // Division of (sum / scaledTotal) underflows
}

GraphMeterMode_computeColors(this, context, valueStart, deltaExp, scaledTotal, numDots);
GraphMeterMode_computeColors(this, context, valueStart, deltaExp, scaledTotal, (unsigned int)numDots);

if (isPercentChart || !(scaledTotal < DBL_MAX) || (1U << deltaExp) >= graphHeight) {
break;
Expand Down

0 comments on commit 1649731

Please sign in to comment.