From a76d745acf1bb446a6befc23c75a59a643c5ef7e Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Mon, 5 Feb 2024 18:59:18 +0800 Subject: [PATCH] needsExtraCell() results compare ops --- Meter.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Meter.c b/Meter.c index 2727a18b3..c5abdefd8 100644 --- a/Meter.c +++ b/Meter.c @@ -735,27 +735,18 @@ static void GraphMeterMode_computeColors(Meter* this, const GraphDrawContext* co if (adjLarge.nCells > adjSmall.nCells) { int res = GraphMeterMode_needsExtraCell(graphHeight, scaledTotal, y, &stack, &adjLarge); - if (res == 1) { + if (res > 0 || (res < 0 && rItemMinCells <= nCells)) { rItemHasExtraCell = true; break; } - if (res == -1) { - if (rItemMinCells <= nCells) { - rItemHasExtraCell = true; - break; - } - } } if (rItemHasExtraCell) { int res = GraphMeterMode_needsExtraCell(graphHeight, scaledTotal, y, &stack, &adjSmall); - if (res == 0) { + if (res == 0 || (res < 0 && rItemMinCells > nCells)) { rItemHasExtraCell = false; - } else if (res == -1) { - if (rItemMinCells > nCells) { - rItemHasExtraCell = false; - } + // Do not break the loop here } } }