mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Add compatibility hack for unused colors in indexed PNGs
This commit is contained in:
@@ -374,7 +374,7 @@ void Palette::addColor(uint16_t color) {
|
||||
}
|
||||
|
||||
uint8_t Palette::indexOf(uint16_t color) const {
|
||||
return std::distance(colors.begin(), std::find(colors.begin(), colors.end(), color));
|
||||
return std::find(colors.begin(), colors.end(), color) - colors.begin();
|
||||
}
|
||||
|
||||
auto Palette::begin() -> decltype(colors)::iterator {
|
||||
@@ -390,3 +390,7 @@ auto Palette::begin() const -> decltype(colors)::const_iterator {
|
||||
auto Palette::end() const -> decltype(colors)::const_iterator {
|
||||
return std::find(colors.begin(), colors.end(), UINT16_MAX);
|
||||
}
|
||||
|
||||
uint8_t Palette::size() const {
|
||||
return indexOf(UINT16_MAX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user