From beff079880d47469b722a251c92027810ba39396 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Tue, 20 Apr 2021 00:57:26 +0100 Subject: [PATCH] Don't try to check the same colour repeatedly --- agb-image-converter/src/palette16.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agb-image-converter/src/palette16.rs b/agb-image-converter/src/palette16.rs index 5522c937..d83d6f2c 100644 --- a/agb-image-converter/src/palette16.rs +++ b/agb-image-converter/src/palette16.rs @@ -141,6 +141,10 @@ impl Palette16Optimiser { } for colour in ¤t_palette.colours { + if palette.colours.contains(&colour) { + continue; + } + if let Some(colour_index) = self.colours.iter().position(|c| c == colour) { colour_usage[colour_index] += 1; a_colour_is_used = true;