GRAPHICS: Return flag if palette was updated for the palette lookup

This commit is contained in:
Eugene Sandulenko 2022-07-03 23:24:18 +02:00
parent 1edcbcb53e
commit c87c02c5ae
No known key found for this signature in database
GPG key ID: 014D387312D34F08
2 changed files with 7 additions and 3 deletions

View file

@ -32,14 +32,16 @@ PaletteLookup::PaletteLookup(const byte *palette, uint len) {
memcpy(_palette, palette, len * 3);
}
void PaletteLookup::setPalette(const byte *palette, uint len) {
bool PaletteLookup::setPalette(const byte *palette, uint len) {
// Check if the passed palette matched the one we have
if (len == _paletteSize && !memcmp(_palette, palette, len * 3))
return;
return false;
_paletteSize = len;
memcpy(_palette, palette, len * 3);
_colorHash.clear();
return true;
}
byte PaletteLookup::findBestColor(byte cr, byte cg, byte cb) {