MCPcopy Create free account
hub / github.com/ImageOptim/libimagequant / new

Method new

src/mediancut.rs:29–36  ·  view source on GitHub ↗
(hist: &'hist mut [HistItem])

Source from the content-addressed store, hash-verified

27
28impl<'hist> MBox<'hist> {
29 pub fn new(hist: &'hist mut [HistItem]) -> Self {
30 let weight_sum = hist.iter().map(|item| {
31 debug_assert!(item.adjusted_weight.is_finite());
32 debug_assert!(item.adjusted_weight > 0.);
33 f64::from(item.adjusted_weight)
34 }).sum();
35 Self::new_inner(hist, weight_sum, weighed_average_color(hist))
36 }
37
38 fn from_split(hist: &'hist mut [HistItem], adjusted_weight_sum: f64) -> Self {
39 debug_assert!(!hist.is_empty());

Callers

nothing calls this directly

Calls 3

weighed_average_colorFunction · 0.85
newFunction · 0.85
push_in_capMethod · 0.80

Tested by

no test coverage detected