(&mut self, attr: &Attributes, freeze_result_colors: bool)
| 188 | |
| 189 | #[inline(never)] |
| 190 | pub(crate) fn quantize_internal(&mut self, attr: &Attributes, freeze_result_colors: bool) -> Result<QuantizationResult, Error> { |
| 191 | if self.hashmap.is_empty() && self.fixed_colors.is_empty() { |
| 192 | return Err(Unsupported); |
| 193 | } |
| 194 | |
| 195 | if attr.progress(0.) { return Err(Aborted); } |
| 196 | if attr.progress(f32::from(attr.progress_stage1) * 0.89) { |
| 197 | return Err(Aborted); |
| 198 | } |
| 199 | |
| 200 | let gamma = self.gamma.unwrap_or(0.45455); |
| 201 | let hist = self.finalize_builder(gamma).map_err(|_| OutOfMemory)?; |
| 202 | |
| 203 | attr.verbose_print(format!(" made histogram...{} colors found", hist.items.len())); |
| 204 | |
| 205 | QuantizationResult::new(attr, hist, freeze_result_colors, gamma) |
| 206 | } |
| 207 | |
| 208 | #[inline(always)] |
| 209 | fn add_color(&mut self, rgba: RGBA, boost: u32) { |
no test coverage detected