Skip to content

Commit 38d54b2

Browse files
committed
Fix sorting of indexed palettes
1 parent 0bd3bbf commit 38d54b2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/gfx/pal_sorting.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ 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
30-
for (int i = 0; i < palSize; ++i) {
31+
for (size_t i = palID * 4; i < palID * 4 + 4; ++i) {
3132
uint16_t color = pngToRgb(i).cgbColor();
3233
if (color == Rgba::transparent) {
3334
continue;

0 commit comments

Comments
 (0)