GRAPHICS: Return flag if palette was updated for the palette lookup
This commit is contained in:
parent
1edcbcb53e
commit
c87c02c5ae
2 changed files with 7 additions and 3 deletions
|
@ -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) {
|
||||
|
|
|
@ -128,8 +128,10 @@ public:
|
|||
*
|
||||
* @param palette the palette data, in interleaved RGB format
|
||||
* @param len the number of palette entries to be read
|
||||
*
|
||||
* @return true if palette was changed and false if it was the same
|
||||
*/
|
||||
void setPalette(const byte *palette, uint len);
|
||||
bool setPalette(const byte *palette, uint len);
|
||||
|
||||
/**
|
||||
* @brief This method returns closest color from the palette
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue