shithub: rgbds

Download patch

ref: a77b0b396a9e3c5dc96bf88ab79d43e98b8f3e10
parent: 568fb5e4c8c60a78c8b4d930ba4adf7e2e48dbc4
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun Apr 24 22:22:22 EDT 2022

Fix grayscale sorting not setting palette size

A black+white palette would turn into white+transparent, removing black pixels
from the palette (the third slot would be empty, and the 4th slot be set directly)

--- a/src/gfx/pal_sorting.cpp
+++ b/src/gfx/pal_sorting.cpp
@@ -76,7 +76,7 @@
 	assert(palettes.size() == 1);
 
 	Palette &palette = palettes[0];
-	std::fill(palette.begin(), palette.end(), Rgba::transparent);
+	std::fill(palette.colors.begin(), palette.colors.end(), Rgba::transparent);
 	for (auto const &slot : colors) {
 		if (!slot.has_value() || slot->isTransparent()) {
 			continue;