diff --git a/src/gfx/pal_spec.cpp b/src/gfx/pal_spec.cpp index 2f53a8fe..484b57b8 100644 --- a/src/gfx/pal_spec.cpp +++ b/src/gfx/pal_spec.cpp @@ -371,13 +371,13 @@ static void parseGPLFile(std::filebuf &file) { return; } - ++nbColors; if (nbColors < maxNbColors) { - if (nbColors % options.nbColorsPerPal == 1) { + if (nbColors % options.nbColorsPerPal == 0) { options.palSpec.emplace_back(); } options.palSpec.back()[nbColors % options.nbColorsPerPal] = *color; } + ++nbColors; } if (nbColors > maxNbColors) { @@ -419,13 +419,13 @@ static void parseHEXFile(std::filebuf &file) { Rgba color = Rgba(toHex(line[0], line[1]), toHex(line[2], line[3]), toHex(line[4], line[5]), 0xFF); - ++nbColors; if (nbColors < maxNbColors) { - if (nbColors % options.nbColorsPerPal == 1) { + if (nbColors % options.nbColorsPerPal == 0) { options.palSpec.emplace_back(); } options.palSpec.back()[nbColors % options.nbColorsPerPal] = color; } + ++nbColors; } if (nbColors > maxNbColors) { diff --git a/test/gfx/full_hex.flags b/test/gfx/full_hex.flags new file mode 100644 index 00000000..6f6b25ad --- /dev/null +++ b/test/gfx/full_hex.flags @@ -0,0 +1 @@ +-c hex:full_hex.hex diff --git a/test/gfx/full_hex.hex b/test/gfx/full_hex.hex new file mode 100644 index 00000000..76b6c5f8 --- /dev/null +++ b/test/gfx/full_hex.hex @@ -0,0 +1,39 @@ +e77300 +008cce +634218 +000000 + +efd600 +5ad639 +008cce +000000 + +efd600 +ef9c8c +5ab5ef +008cce + +efd600 +5ad639 +39217b +000000 + +efd600 +00ef63 +5ab5ef +316331 + +efd600 +adadc6 +ef9c8c +5ab5ef + +e77300 +634218 +39217b +000000 + +5ad639 +316331 +39217b +000000 diff --git a/test/gfx/full_hex.png b/test/gfx/full_hex.png new file mode 100644 index 00000000..316b6e9a Binary files /dev/null and b/test/gfx/full_hex.png differ