diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-02-05 14:58:20 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-03-06 13:52:25 +0100 |
commit | fb44fc81bdab09d079ed27e22b86718627ded48b (patch) | |
tree | 2a4e7c80eb49624c0b548d7bd33401792da1faa4 /include/mbgl | |
parent | 0151fe6c01367ef03a2ff282b90e32dd3785a7c2 (diff) | |
download | qtlocation-mapboxgl-fb44fc81bdab09d079ed27e22b86718627ded48b.tar.gz |
make Map::resize() private
they can only be called by View::resize
Diffstat (limited to 'include/mbgl')
-rw-r--r-- | include/mbgl/android/native_map_view.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/map/map.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/map/view.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/platform/default/glfw_view.hpp | 10 |
4 files changed, 17 insertions, 9 deletions
diff --git a/include/mbgl/android/native_map_view.hpp b/include/mbgl/android/native_map_view.hpp index bfe544c2b0..eb5f295eaf 100644 --- a/include/mbgl/android/native_map_view.hpp +++ b/include/mbgl/android/native_map_view.hpp @@ -49,6 +49,8 @@ public: void enableFps(bool enable); void updateFps(); + void resize(uint16_t width, uint16_t height, float ratio, uint16_t fbWidth, uint16_t fbHeight); + private: EGLConfig chooseConfig(const EGLConfig configs[], EGLint numConfigs); diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index fed68cb08a..ed156c5d22 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -43,6 +43,8 @@ struct exception : std::runtime_error { }; class Map : private util::noncopyable { + friend class View; + public: explicit Map(View&, FileSource&); ~Map(); @@ -80,10 +82,6 @@ public: bool needsSwap(); void swapped(); - // Size - void resize(uint16_t width, uint16_t height, float ratio = 1); - void resize(uint16_t width, uint16_t height, float ratio, uint16_t fbWidth, uint16_t fbHeight); - // Styling void addClass(const std::string&); void removeClass(const std::string&); @@ -152,6 +150,10 @@ public: inline std::chrono::steady_clock::time_point getTime() const { return animationTime; } private: + // This may only be called by the View object. + void resize(uint16_t width, uint16_t height, float ratio = 1); + void resize(uint16_t width, uint16_t height, float ratio, uint16_t fbWidth, uint16_t fbHeight); + util::ptr<Sprite> getSprite(); uv::worker& getWorker(); diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp index b94b8c0b93..7d8c25f445 100644 --- a/include/mbgl/map/view.hpp +++ b/include/mbgl/map/view.hpp @@ -47,6 +47,10 @@ public: virtual void notifyMapChange(MapChange change, std::chrono::steady_clock::duration delay = std::chrono::steady_clock::duration::zero()) = 0; protected: + // Resizes the view + void resize(uint16_t width, uint16_t height, float ratio, uint16_t fbWidth, uint16_t fbHeight); + +protected: mbgl::Map *map = nullptr; }; } diff --git a/include/mbgl/platform/default/glfw_view.hpp b/include/mbgl/platform/default/glfw_view.hpp index 7156d4ff1f..8f5cfb7281 100644 --- a/include/mbgl/platform/default/glfw_view.hpp +++ b/include/mbgl/platform/default/glfw_view.hpp @@ -20,11 +20,11 @@ public: void notify(); void notifyMapChange(mbgl::MapChange change, std::chrono::steady_clock::duration delay = std::chrono::steady_clock::duration::zero()); - static void key(GLFWwindow *window, int key, int scancode, int action, int mods); - static void scroll(GLFWwindow *window, double xoffset, double yoffset); - static void resize(GLFWwindow *window, int width, int height); - static void mouseClick(GLFWwindow *window, int button, int action, int modifiers); - static void mouseMove(GLFWwindow *window, double x, double y); + static void onKey(GLFWwindow *window, int key, int scancode, int action, int mods); + static void onScroll(GLFWwindow *window, double xoffset, double yoffset); + static void onResize(GLFWwindow *window, int width, int height); + static void onMouseClick(GLFWwindow *window, int button, int action, int modifiers); + static void onMouseMove(GLFWwindow *window, double x, double y); static void eventloop(void *arg); |