Implement -c #none (#1301)

Also adds a test case for round-tripping `-r` with `-c #none`.
This commit is contained in:
Evie
2024-03-03 18:45:33 -05:00
committed by GitHub
parent 930a5c3e44
commit 6b67c82b94
12 changed files with 95 additions and 38 deletions

View File

@@ -576,8 +576,11 @@ static std::tuple<DefaultInitVec<size_t>, std::vector<Palette>>
// Convert the palette spec to actual palettes
std::vector<Palette> palettes(options.palSpec.size());
for (auto [spec, pal] : zip(options.palSpec, palettes)) {
for (size_t i = 0; i < options.nbColorsPerPal && spec[i].isOpaque(); ++i) {
pal[i] = spec[i].cgbColor();
for (size_t i = 0; i < options.nbColorsPerPal && (!spec[i] || spec[i]->isOpaque()); ++i) {
// If the spec has a gap, there's no need to copy anything.
if (spec[i]) {
pal[i] = spec[i]->cgbColor();
}
}
}