From 85e62c6eeb367a93d515b0be3ba074fb725fdeaf Mon Sep 17 00:00:00 2001 From: Damocles Date: Sat, 25 Apr 2026 10:03:06 +0200 Subject: [PATCH] sparkline: fix subpixel rounding gaps between bars --- shell/applets/SparklineCanvas.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell/applets/SparklineCanvas.qml b/shell/applets/SparklineCanvas.qml index cffabb1..4322656 100644 --- a/shell/applets/SparklineCanvas.qml +++ b/shell/applets/SparklineCanvas.qml @@ -142,10 +142,12 @@ Canvas { if (hasCF) ctx.fillStyle = colorFunction(d[i]).toString(); const [bx, bw] = xOf(i); + const x0 = Math.floor(bx); + const x1 = Math.floor(bx + bw); const dy = yOf(d[i]); const barTop = Math.min(dy, zy); const barH = Math.max(1, Math.abs(dy - zy)); - ctx.fillRect(bx, barTop, Math.ceil(bw), barH); + ctx.fillRect(x0, barTop, Math.max(1, x1 - x0), barH); } } }