summaryrefslogtreecommitdiff
path: root/src/mbgl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl')
-rw-r--r--src/mbgl/algorithm/generate_clip_ids.hpp3
-rw-r--r--src/mbgl/algorithm/generate_clip_ids_impl.hpp7
-rw-r--r--src/mbgl/algorithm/update_tile_masks.hpp6
3 files changed, 9 insertions, 7 deletions
diff --git a/src/mbgl/algorithm/generate_clip_ids.hpp b/src/mbgl/algorithm/generate_clip_ids.hpp
index adcf87a72a..6950433578 100644
--- a/src/mbgl/algorithm/generate_clip_ids.hpp
+++ b/src/mbgl/algorithm/generate_clip_ids.hpp
@@ -25,8 +25,9 @@ private:
std::multimap<UnwrappedTileID, Leaf> pool;
public:
+ // The given vector must be sorted by id.
template <typename Renderable>
- void update(std::vector<std::reference_wrapper<Renderable>> renderables);
+ void update(std::vector<std::reference_wrapper<Renderable>> sortedRenderables);
std::map<UnwrappedTileID, ClipID> getClipIDs() const;
};
diff --git a/src/mbgl/algorithm/generate_clip_ids_impl.hpp b/src/mbgl/algorithm/generate_clip_ids_impl.hpp
index fedab06022..a4af9c8cbb 100644
--- a/src/mbgl/algorithm/generate_clip_ids_impl.hpp
+++ b/src/mbgl/algorithm/generate_clip_ids_impl.hpp
@@ -10,12 +10,11 @@ namespace algorithm {
template <typename Renderable>
void ClipIDGenerator::update(std::vector<std::reference_wrapper<Renderable>> renderables) {
std::size_t size = 0;
-
- std::sort(renderables.begin(), renderables.end(),
- [](const auto& a, const auto& b) { return a.get().id < b.get().id; });
+ assert(std::is_sorted(renderables.begin(), renderables.end(),
+ [](const Renderable& a, const Renderable& b) { return a.id < b.id; }));
const auto end = renderables.end();
- for (auto it = renderables.begin(); it != end; it++) {
+ for (auto it = renderables.begin(); it != end; ++it) {
auto& renderable = it->get();
if (!renderable.used || !renderable.needsClipping) {
continue;
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();