remove unneeded functions

This commit is contained in:
2025-03-24 17:04:58 -04:00
parent 70354a4111
commit 68e5d9fc3a

View File

@@ -29,13 +29,6 @@ impl ThinGridData {
} }
// from grid.rs (needed in image gen) // from grid.rs (needed in image gen)
#[allow(dead_code)]
pub fn data(&self) -> &[f32] {
&self.data
}
// from grid.rs (needed in image gen)
#[allow(dead_code)]
pub fn quantile(&self, fraction: f32) -> f32 { pub fn quantile(&self, fraction: f32) -> f32 {
let index = if (fraction - 1.0_f32).abs() < f32::EPSILON { let index = if (fraction - 1.0_f32).abs() < f32::EPSILON {
self.data.len() - 1 self.data.len() - 1
@@ -58,7 +51,7 @@ pub struct ImgData {
} }
impl ImgData { impl ImgData {
pub fn new(in_grids: Vec<ThinGridData>, in_palette: Palette) -> Self { pub const fn new(in_grids: Vec<ThinGridData>, in_palette: Palette) -> Self {
ImgData { ImgData {
grids: in_grids, grids: in_grids,
palette: in_palette, palette: in_palette,
@@ -82,7 +75,7 @@ impl ImgData {
for (grid, max_value, color) in for (grid, max_value, color) in
multizip((&self.grids, &max_values, &self.palette.colors)) multizip((&self.grids, &max_values, &self.palette.colors))
{ {
let mut t = (grid.data()[i] / max_value).clamp(0.0, 1.0); let mut t = (grid.data[i] / max_value).clamp(0.0, 1.0);
t = t.powf(1.0 / 2.2); // gamma correction t = t.powf(1.0 / 2.2); // gamma correction
r += color.0[0] as f32 * t; r += color.0[0] as f32 * t;
g += color.0[1] as f32 * t; g += color.0[1] as f32 * t;