Don't try to check the same colour repeatedly

This commit is contained in:
Gwilym Kuiper 2021-04-20 00:57:26 +01:00
parent b5e01fc2dc
commit beff079880

View file

@ -141,6 +141,10 @@ impl Palette16Optimiser {
} }
for colour in &current_palette.colours { for colour in &current_palette.colours {
if palette.colours.contains(&colour) {
continue;
}
if let Some(colour_index) = self.colours.iter().position(|c| c == colour) { if let Some(colour_index) = self.colours.iter().position(|c| c == colour) {
colour_usage[colour_index] += 1; colour_usage[colour_index] += 1;
a_colour_is_used = true; a_colour_is_used = true;