mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-15 19:52:05 +00:00
lua: Avoid cmd::SetPalette() when there is nothing to change
This commit is contained in:
parent
f1f888a819
commit
3fddf4dfef
@ -97,9 +97,11 @@ int Palette_resize(lua_State* L)
|
||||
Palette newPal(*pal);
|
||||
newPal.resize(ncolors);
|
||||
|
||||
Tx tx;
|
||||
tx(new cmd::SetPalette(sprite, pal->frame(), &newPal));
|
||||
tx.commit();
|
||||
if (*pal != newPal) {
|
||||
Tx tx;
|
||||
tx(new cmd::SetPalette(sprite, pal->frame(), &newPal));
|
||||
tx.commit();
|
||||
}
|
||||
}
|
||||
else
|
||||
pal->resize(ncolors);
|
||||
@ -135,6 +137,10 @@ int Palette_setColor(lua_State* L)
|
||||
doc::color_t docColor = convert_args_into_pixel_color(L, 3);
|
||||
|
||||
if (auto sprite = obj->sprite(L)) {
|
||||
// Nothing to do
|
||||
if (pal->getEntry(i) == docColor)
|
||||
return 0;
|
||||
|
||||
Palette newPal(*pal);
|
||||
newPal.setEntry(i, docColor);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user