summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry/line_atlas.hpp
blob: df60a2dec5304583de5f174a4a029649266b328c (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
36
37
38
39
40
41
#ifndef MBGL_GEOMETRY_LINE_ATLAS
#define MBGL_GEOMETRY_LINE_ATLAS

#include <vector>
#include <map>
#include <mutex>
#include <atomic>

namespace mbgl {

typedef struct {
    float width;
    float height;
    float y;
} LinePatternPos;

class LineAtlas {
public:
    LineAtlas(uint16_t width, uint16_t height);
    ~LineAtlas();

    void bind();

    LinePatternPos getDashPosition(const std::vector<float>&, bool);
    LinePatternPos addDash(const std::vector<float> &dasharray, bool round);

    const int width;
    const int height;

private:
    std::recursive_mutex mtx;
    char *const data = nullptr;
    std::atomic<bool> dirty;
    uint32_t texture = 0;
    int nextRow = 0;
    std::map<size_t, LinePatternPos> positions;
};

};

#endif