make Map::resize() private

they can only be called by View::resize
This commit is contained in:
Konstantin Käfer
2015-02-05 14:58:20 +01:00
parent 0151fe6c01
commit fb44fc81bd
12 changed files with 57 additions and 73 deletions

View File

@@ -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);

View File

@@ -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();

View File

@@ -46,6 +46,10 @@ public:
// Must not be called from the render thread.
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;
};

View File

@@ -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);