Skip to content

Commit 20e3ecb

Browse files
committed
Fix sorting of indexed palettes
1 parent 0bd3bbf commit 20e3ecb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/gfx/main-495e5436.o.tmp

Whitespace-only changes.

src/gfx/pal_sorting.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ void sortIndexed(
2424
);
2525
};
2626

27-
for (Palette &pal : palettes) {
27+
for (size_t palID = 0; palID < palettes.size(); ++palID) {
28+
Palette &pal = palettes[palID];
2829
std::sort(RANGE(pal), [&](uint16_t lhs, uint16_t rhs) {
2930
// Iterate through the PNG's palette, looking for either of the two
3031
for (int i = 0; i < palSize; ++i) {
31-
uint16_t color = pngToRgb(i).cgbColor();
32+
uint16_t color = pngToRgb((palID * 4 + i) % palSize).cgbColor();
3233
if (color == Rgba::transparent) {
3334
continue;
3435
}

0 commit comments

Comments
 (0)