blob: 27af4fc9d9d24dbd8fb47d2641e2f2ea46d88cf8 (
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
|
#pragma once
#include <mbgl/map/view.hpp>
#include <mbgl/gl/types.hpp>
namespace mbgl {
class HeadlessView : public View {
public:
HeadlessView(float pixelRatio = 1, uint16_t width = 256, uint16_t height = 256);
~HeadlessView() override;
void bind() override;
std::array<uint16_t, 2> getSize() const override;
std::array<uint16_t, 2> getFramebufferSize() const override;
PremultipliedImage readStillImage(std::array<uint16_t, 2> size = {{ 0, 0 }}) override;
float getPixelRatio() const;
void resize(uint16_t width, uint16_t height);
private:
void clearBuffers();
void resizeFramebuffer();
void bindFramebuffer();
private:
const float pixelRatio;
std::array<uint16_t, 2> dimensions;
bool needsResize = false;
gl::FramebufferID fbo = 0;
gl::RenderbufferID fboDepthStencil = 0;
gl::RenderbufferID fboColor = 0;
};
} // namespace mbgl
|