blob: 57bfd62b262703d12022e80672b838fa7c64e86e (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#pragma once
#include "android_gl_thread.hpp"
#include <mbgl/actor/actor.hpp>
#include <mbgl/annotation/annotation.hpp>
#include <mbgl/renderer/renderer_backend.hpp>
#include <mbgl/renderer/renderer_frontend.hpp>
#include <mbgl/util/async_task.hpp>
#include <mbgl/util/geo.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/run_loop.hpp>
#include <functional>
#include <memory>
#include <vector>
#include <string>
namespace mbgl {
class FileSource;
class Scheduler;
class RenderedQueryOptions;
class SourceQueryOptions;
namespace android {
class AndroidRendererBackend;
class AndroidRendererFrontend : public RendererFrontend {
public:
using RequestRenderCallback = std::function<void ()>;
using RequestProcessingCallback = std::function<void ()>;
AndroidRendererFrontend(float pixelRatio,
mbgl::FileSource&,
mbgl::Scheduler&,
std::string programCacheDir,
RequestRenderCallback,
RequestProcessingCallback);
~AndroidRendererFrontend() override;
void reset() override;
void setObserver(RendererObserver&) override;
void update(std::shared_ptr<UpdateParameters>) override;
// Called from OpenGL Thread
void render();
void process();
// Feature querying
std::vector<Feature> queryRenderedFeatures(const ScreenCoordinate&, const RenderedQueryOptions&) const;
std::vector<Feature> queryRenderedFeatures(const ScreenBox&, const RenderedQueryOptions&) const;
std::vector<Feature> querySourceFeatures(const std::string& sourceID, const SourceQueryOptions&) const;
AnnotationIDs queryPointAnnotations(const ScreenBox& box) const;
// RenderBackend proxy - Called from OpenGL Thread
void resizeFramebuffer(int width, int height);
// Memory
void onLowMemory();
// Snapshot - Callback will be called on calling thread through RunLoop
using SnapshotCallback = std::function<void (PremultipliedImage)>;
void requestSnapshot(SnapshotCallback);
private:
std::unique_ptr<AndroidRendererBackend> backend;
std::unique_ptr<AndroidGLThread> glThread;
std::unique_ptr<RendererObserver> rendererObserver;
std::mutex updateMutex;
std::shared_ptr<UpdateParameters> updateParameters;
util::AsyncTask asyncInvalidate;
util::RunLoop* mapRunLoop;
bool framebufferSizeChanged = true;
std::unique_ptr<SnapshotCallback> snapshotCallback;
};
} // namespace android
} // namespace mbgl
|