8 const std::set<PrefilledPalette> &prefilled_palettes,
PalettePool &palette_pool, std::size_t palette_capacity)
10 std::vector<PackedPalette> palettes;
12 for (
const auto &prefilled_palette : prefilled_palettes) {
14 if (palette_pool.
is_available(prefilled_palette.hardware_index())) {
15 palette_pool.
checkout(prefilled_palette.hardware_index());
19 const ColorSet fixed_colors = prefilled_palette.fixed_colors();
21 const std::size_t occupied_slot_count = prefilled_palette.occupied_slots();
22 const std::size_t wasted_slot_count = occupied_slot_count - unique_color_count;
23 const std::size_t effective_capacity = palette_capacity - wasted_slot_count;
26 if (unique_color_count > 0) {
30 palette.add_tile(system_tile);
32 palettes.push_back(std::move(palette));
A set of colors represented as a bitset.
Identifies a tile created from a prefilled palette.
Wraps a ColorSet with a tile ID for tracking during palette packing.
Represents a hardware palette after packing with accumulated colors and assigned tiles.
std::size_t hardware_index() const
Manages allocation of hardware palette indexes with stack-based checkout semantics.
std::size_t checkout()
Checks out the next available hardware palette index.
bool is_available(std::size_t hardware_index) const
Checks if a specific index is available for checkout.
std::size_t color_set_count(const ColorSet &set)
Counts the number of colors in a ColorSet.
std::vector< PackedPalette > initialize_packed_palettes(const std::set< PrefilledPalette > &prefilled_palettes, PalettePool &palette_pool, std::size_t palette_capacity)
Initializes packed palettes from prefilled palettes.