mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-23 22:27:06 +00:00
Only sort generated palette colors by PLTE order for indexed PNG images
Non-indexed images can still have a PLTE chunk. We should use `sortRgb` instead of `sortIndexed` for them, since their pixels' colors may not all be present in the PLTE chunk and would be unsortable.
This commit is contained in:
@@ -177,6 +177,7 @@ Png::Png(char const *filename, std::streambuf &file) {
|
||||
break;
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
png_set_palette_to_rgb(png);
|
||||
isIndexed = true; // This enables sorting generated palette colors by the PLTE chunk
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user