(&mut self, rgba: RGBA, boost: u32)
| 207 | |
| 208 | #[inline(always)] |
| 209 | fn add_color(&mut self, rgba: RGBA, boost: u32) { |
| 210 | if boost == 0 { |
| 211 | return; |
| 212 | } |
| 213 | |
| 214 | let px_int = if rgba.a != 0 { |
| 215 | self.posterize_mask() & unsafe { RGBAInt { rgba }.int } |
| 216 | } else { 0 }; |
| 217 | |
| 218 | self.hashmap.entry(px_int) |
| 219 | // it can overflow on images over 2^24 pixels large |
| 220 | .and_modify(move |e| e.0 = e.0.saturating_add(boost)) |
| 221 | .or_insert((boost, rgba)); |
| 222 | } |
| 223 | |
| 224 | fn reserve(&mut self, entries: usize) { |
| 225 | let new_entries = entries.saturating_sub(self.hashmap.len() / 3); // assume some will be dupes, if called multiple times |
no test coverage detected