mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-27 12:20:58 +00:00
Avoid an extra palette entry for the mask color in PaletteOptimizer::calculate() (fix #771)
This commit is contained in:
parent
2bb926742f
commit
ffba179712
@ -379,13 +379,23 @@ void PaletteOptimizer::feedWithRgbaColor(color_t color)
|
||||
void PaletteOptimizer::calculate(Palette* palette, int maskIndex,
|
||||
PaletteOptimizerDelegate* delegate)
|
||||
{
|
||||
bool addMask;
|
||||
|
||||
if ((palette->size() > 1) &&
|
||||
(maskIndex >= 0 && maskIndex < palette->size())) {
|
||||
palette->resize(palette->size()-1);
|
||||
addMask = true;
|
||||
}
|
||||
else
|
||||
addMask = false;
|
||||
|
||||
// If the sprite has a background layer, the first entry can be
|
||||
// used, in other case the 0 indexed will be the mask color, so it
|
||||
// will not be used later in the color conversion (from RGB to
|
||||
// Indexed).
|
||||
int usedColors = m_histogram.createOptimizedPalette(palette);
|
||||
|
||||
if (maskIndex >= 0 && maskIndex < usedColors) {
|
||||
if (addMask) {
|
||||
palette->resize(usedColors+1);
|
||||
|
||||
Remap remap(palette->size());
|
||||
|
Loading…
Reference in New Issue
Block a user