diff --git a/src/imgdata.rs b/src/imgdata.rs index 7abf72e..1259cf0 100644 --- a/src/imgdata.rs +++ b/src/imgdata.rs @@ -29,13 +29,6 @@ impl ThinGridData { } // 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 { let index = if (fraction - 1.0_f32).abs() < f32::EPSILON { self.data.len() - 1 @@ -58,7 +51,7 @@ pub struct ImgData { } impl ImgData { - pub fn new(in_grids: Vec, in_palette: Palette) -> Self { + pub const fn new(in_grids: Vec, in_palette: Palette) -> Self { ImgData { grids: in_grids, palette: in_palette, @@ -82,7 +75,7 @@ impl ImgData { for (grid, max_value, color) in 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 r += color.0[0] as f32 * t; g += color.0[1] as f32 * t;