mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-05 21:57:20 +00:00
A GIF color map cannot have more than 256 colors
This commit is contained in:
parent
ae2f04f855
commit
65fe7dbccf
@ -658,6 +658,9 @@ bool GifFormat::onLoad(FileOp* fop)
|
||||
#ifdef ENABLE_SAVE
|
||||
static int next_power_of_two(int color_map_size)
|
||||
{
|
||||
if (color_map_size > 256)
|
||||
return 256;
|
||||
|
||||
for (int i = 30; i >= 0; --i) {
|
||||
if (color_map_size & (1 << i)) {
|
||||
color_map_size = (1 << (i + (color_map_size & (1 << (i - 1)) ? 1: 0)));
|
||||
|
Loading…
Reference in New Issue
Block a user