diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-07-01 12:39:21 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-07-08 10:40:05 +0200 |
commit | 675ddddee78fa36d60d55c266033f05edda4be48 (patch) | |
tree | e7e09473400600070778b620d1cd1eb0a78d7b7d /include/mbgl/map/view.hpp | |
parent | 3a07cb2f1edb4e8f5e076ec0fef32f733676a95c (diff) | |
download | qtlocation-mapboxgl-675ddddee78fa36d60d55c266033f05edda4be48.tar.gz |
Make pixelRatio constant across a Map object lifetime
also moves framebuffer size out of TransformState into its own object
Diffstat (limited to 'include/mbgl/map/view.hpp')
-rw-r--r-- | include/mbgl/map/view.hpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp index 575d0df015..3086d51aab 100644 --- a/include/mbgl/map/view.hpp +++ b/include/mbgl/map/view.hpp @@ -30,6 +30,21 @@ enum MapChange : uint8_t { class View { public: + // Called from the main thread directly after initialization. Must always return the same value, + // i.e. it may not change over time. + virtual float getPixelRatio() const = 0; + + // Called from the main thread when the View signaled a dimension change. Must return the + // logical dimension of this map in pixels. + virtual std::array<uint16_t, 2> getSize() const = 0; + + // Called from the main thread for every frame that is being rendered. Must return the absolute + // dimensions of the current framebuffer. Typically, this is the logical width scaled by the + // pixel ratio, but in case the view was moved to display with a different pixel ratio, it can + // also be different from that rule. + virtual std::array<uint16_t, 2> getFramebufferSize() const = 0; + + // Called from the main thread when this View is associated with a Map object. virtual void initialize(Map *map_); // Called from the render thread. Makes the GL context active in the current @@ -43,9 +58,6 @@ public: virtual void notify() = 0; - // Called from the render thread. The implementation should resize the framebuffer. - virtual void resize(uint16_t width, uint16_t height, float pixelRatio); - // Called from the render thread. The implementation must trigger a rerender. // (map->renderSync() from the main thread must be called as a result of this) virtual void invalidate() = 0; |