From 675ddddee78fa36d60d55c266033f05edda4be48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 1 Jul 2015 12:39:21 +0200 Subject: Make pixelRatio constant across a Map object lifetime also moves framebuffer size out of TransformState into its own object --- include/mbgl/map/view.hpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'include/mbgl/map/view.hpp') 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 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 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; -- cgit v1.2.1