From f696d895b44234b4be3398cce4fd9eb0ec6bfb9e Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 24 Mar 2016 17:37:04 -0300 Subject: [PATCH] Do not remap indexes between palette entries that are equal (fix #914) --- src/doc/remap.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/doc/remap.cpp b/src/doc/remap.cpp index c8350f67f..cd1e6a5b5 100644 --- a/src/doc/remap.cpp +++ b/src/doc/remap.cpp @@ -102,6 +102,14 @@ Remap create_remap_to_change_palette( continue; const color_t color = oldPalette->getEntry(i); + + // If in both palettes, it's the same color, we don't need to + // remap this entry. + if (color == newPalette->getEntry(i)) { + remap.map(i, i); + continue; + } + int j = newPalette->findExactMatch( rgba_getr(color), rgba_getg(color),