mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-06 11:48:24 +00:00
The pacing commit left the queue drain, the decay trail and the fresh-array rule inline in SpectrumCanvas, where none of it could be covered — commonsUI has no Compose test harness, and adding one to a KMP module for three lines of glue is not worth the dependency. Move the whole per-displayed-frame step into SpectrumTrail in commons instead: take one queued frame, decay against what is drawn, return a new array, or null when starved. The composable keeps only the plumbing (collect into offer, drain on withFrameMillis), so what is left untested is code with no branches. Covered: starvation holds the drawn frame, the first frame has nothing to decay from, a rising bin attacks instantly, a falling bin releases gradually, each draw gets a distinct array (mutableStateOf compares by reference, so reuse would silently stop redrawing), and a backlog evicts the stalest frame. Also corrects the SpectrumCanvas KDoc: there is now a per-frame loop whatever `animated` is, so the note about it existing to avoid 60fps redraws no longer described the code. It only governs the monotonic clock.