diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-01-18 13:12:04 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-01-18 14:35:15 +0200 |
commit | b83030aa9bb1a8d9f14ae8160698c1ee4d5a4c72 (patch) | |
tree | 26b9f39ef19bf0c1934f712f986df4600368dd97 /src/mbgl/algorithm/update_tile_masks.hpp | |
parent | d5659aa6647f1fc77159567bd22029a2dc9cd7a3 (diff) | |
download | qtlocation-mapboxgl-b83030aa9bb1a8d9f14ae8160698c1ee4d5a4c72.tar.gz |
[core] Remove tile sorting from the clip and mask algorithms
The tile sorting can be now removed from the algorithms, which
calculate tile mask and clip ids, because their client code
provides tiles being already sorted (in `TilePyramid`).
This patch brings significant improvements to the Tile-related
performance tests results, for example the `TileMaskGeneration`
benchmark test runs 33 times faster with these changes applied.
Diffstat (limited to 'src/mbgl/algorithm/update_tile_masks.hpp')
-rw-r--r-- | src/mbgl/algorithm/update_tile_masks.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mbgl/algorithm/update_tile_masks.hpp b/src/mbgl/algorithm/update_tile_masks.hpp index a7840cd163..c475473cb6 100644 --- a/src/mbgl/algorithm/update_tile_masks.hpp +++ b/src/mbgl/algorithm/update_tile_masks.hpp @@ -95,10 +95,12 @@ void computeTileMasks( // Only other Renderables that are *children* of the Renderable we are generating the mask for will // be considered. For example, adding a Renderable with TileID 4/8/13 won't affect the TileMask for // 2/1/3, since it is not a descendant of it. +// +// The given |renderables| must be sorted by id. template <typename Renderable> void updateTileMasks(std::vector<std::reference_wrapper<Renderable>> renderables) { - std::sort(renderables.begin(), renderables.end(), - [](const Renderable& a, const Renderable& b) { return a.id < b.id; }); + assert(std::is_sorted(renderables.begin(), renderables.end(), + [](const Renderable& a, const Renderable& b) { return a.id < b.id; })); TileMask mask; const auto end = renderables.end(); |