summaryrefslogtreecommitdiff
path: root/src/mbgl/algorithm/generate_clip_ids.hpp
blob: 0454c995246c32d3b1bd85cef647c703ef68008a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include <mbgl/tile/tile_id.hpp>
#include <mbgl/util/clip_id.hpp>

#include <set>
#include <vector>
#include <map>

namespace mbgl {
namespace algorithm {

class ClipIDGenerator {
private:
    struct Leaf {
        Leaf(ClipID&);
        void add(const CanonicalTileID &p);
        bool operator==(const Leaf &other) const;

        std::set<CanonicalTileID> children;
        ClipID& clip;
    };

    uint8_t bit_offset = 0;
    std::multimap<UnwrappedTileID, Leaf> pool;

public:
    template <typename Renderables>
    void update(Renderables& renderables);

    std::map<UnwrappedTileID, ClipID> getStencils() const;
};

} // namespace algorithm
} // namespace mbgl