8 const std::set<PrefilledPalette> &prefilled_pals,
PalettePool &pal_pool, std::size_t pal_capacity)
10 std::vector<PackedPalette> palettes;
12 for (
const auto &prefilled_pal : prefilled_pals) {
14 if (pal_pool.
is_available(prefilled_pal.hardware_index())) {
15 pal_pool.
checkout(prefilled_pal.hardware_index());
19 const ColorSet fixed_colors = prefilled_pal.fixed_colors();
21 const std::size_t occupied_slot_count = prefilled_pal.occupied_slots();
22 const std::size_t wasted_slot_count = occupied_slot_count - unique_color_count;
23 const std::size_t effective_capacity = pal_capacity - wasted_slot_count;
26 if (unique_color_count > 0) {
30 pal.add_tile(system_tile);
32 palettes.push_back(std::move(pal));
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_pals, PalettePool &pal_pool, std::size_t pal_capacity)
Initializes packed palettes from prefilled palettes.