mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-13 01:13:22 +00:00
Fix performance issue/lag drawing in 'Auto' mode on a tilemap layer (fix #2877)
We receive a .aseprite example where the tilemap contain some tiles with huge tile indexes. We don't know why the tilemap was saved with those wrong values (tile index out of bounds), but it was the cause of the lag.
This commit is contained in:
parent
9e10a1c82c
commit
ed8e2c8392
@ -836,6 +836,14 @@ doc::Cel* AsepriteDecoder::readCelChunk(doc::Sprite* sprite,
|
||||
doc::fix_old_tilemap(image.get(), ts, tileIDMask, flagsMask);
|
||||
}
|
||||
|
||||
// normalize the tile, so its value is never out of bounds
|
||||
const doc::tile_index tilesetSize = ts->size();
|
||||
doc::transform_image<doc::TilemapTraits>(
|
||||
image.get(),
|
||||
[tilesetSize](const doc::tile_t& tile){
|
||||
return doc::tile_geti(tile) >= tilesetSize ? doc::notile : tile;
|
||||
});
|
||||
|
||||
cel.reset(new doc::Cel(frame, image));
|
||||
cel->setPosition(x, y);
|
||||
cel->setOpacity(opacity);
|
||||
|
Loading…
x
Reference in New Issue
Block a user