Fix thumbnails for indexed images with transparent color (GIF files mainly)

This commit is contained in:
David Capello 2019-03-28 10:44:06 -03:00
parent d9aa0d5c68
commit 325d675786

View File

@ -105,6 +105,15 @@ private:
// The palette to convert the Image
palette.reset(new Palette(*sprite->palette(frame_t(0))));
// Special case for indexed images:
// If the sprite is transparent -> set the transparent color index alpha = 0
if (sprite->colorMode() == ColorMode::INDEXED &&
!sprite->backgroundLayer()) {
int i = sprite->transparentColor();
if (i >= 0 && i < int(palette->size()))
palette->setEntry(i, doc::rgba(0, 0, 0, 0));
}
const int w = sprite->width()*sprite->pixelRatio().w;
const int h = sprite->height()*sprite->pixelRatio().h;