Skip to content

Commit 91050eb

Browse files
perf(waveform): reduce/eliminate allocations within waveform. other micro-opts.
Signed-off-by: Maika Namuo <httpworldview@gmail.com>
1 parent 00932c1 commit 91050eb

4 files changed

Lines changed: 302 additions & 272 deletions

File tree

src/util/color.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ fn gradient_segment(count: usize, t: f32) -> Option<(usize, f32)> {
7373
})
7474
}
7575

76-
pub fn sample_gradient(palette: &[Color], t: f32) -> Color {
77-
match gradient_segment(palette.len(), t) {
78-
Some((i, f)) => lerp_color(palette[i], palette[i + 1], f),
79-
None => palette.first().copied().unwrap_or(Color::BLACK),
80-
}
81-
}
82-
8376
pub fn sample_rgba_gradient(palette: &[[f32; 4]], t: f32) -> [f32; 4] {
8477
match gradient_segment(palette.len(), t) {
8578
Some((i, f)) => {

0 commit comments

Comments
 (0)