diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-06-26 15:37:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-26 15:37:55 +0200 |
commit | c8617565d84d69b1966878debe61b4c712750780 (patch) | |
tree | bee3b75c8aa2fc017867d96fe232ae6bac6e7779 /scene/2d/tile_map.cpp | |
parent | 80d6882ccd5380e62009d857454c87ca78da98bb (diff) | |
parent | 67a78e020a1254bf9f37a1aee3bcbc31806cf13e (diff) | |
download | redot-engine-c8617565d84d69b1966878debe61b4c712750780.tar.gz |
Merge pull request #19776 from marcelofg55/tilemap_quadrant_opt
Optimize _recreate_quadrants
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r-- | scene/2d/tile_map.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 98275510d6..7fb4e36b63 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -708,7 +708,7 @@ void TileMap::_erase_quadrant(Map<PosKey, Quadrant>::Element *Q) { rect_cache_dirty = true; } -void TileMap::_make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q) { +void TileMap::_make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q, bool update) { Quadrant &q = Q->get(); if (!q.dirty_list.in_list()) @@ -719,7 +719,10 @@ void TileMap::_make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q) { pending_update = true; if (!is_inside_tree()) return; - _update_dirty_quadrants(); + + if (update) { + _update_dirty_quadrants(); + } } void TileMap::set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose) { @@ -1016,8 +1019,9 @@ void TileMap::_recreate_quadrants() { } Q->get().cells.insert(E->key()); - _make_quadrant_dirty(Q); + _make_quadrant_dirty(Q, false); } + _update_dirty_quadrants(); } void TileMap::_clear_quadrants() { |