summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2015-08-20 16:11:32 -0400
committerMike Morris <michael.patrick.morris@gmail.com>2015-08-25 14:39:49 -0400
commit4540c3c0e8c80de4f0074c1c4328840ebf708470 (patch)
treeed131f161734d494655b05fe65b20c44d15f6daa /include
parent15a5532d76c387142db60913c4ce0876d4450eb8 (diff)
downloadqtlocation-mapboxgl-4540c3c0e8c80de4f0074c1c4328840ebf708470.tar.gz
View::swap -> View::beforeRender View::afterRender
To be able to resize the framebuffer on the map thread in HeadlessView.
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/android/native_map_view.hpp3
-rw-r--r--include/mbgl/map/view.hpp5
-rw-r--r--include/mbgl/platform/default/glfw_view.hpp3
-rw-r--r--include/mbgl/platform/default/headless_view.hpp5
4 files changed, 12 insertions, 4 deletions
diff --git a/include/mbgl/android/native_map_view.hpp b/include/mbgl/android/native_map_view.hpp
index 3ae3d6ed91..d5606ae37f 100644
--- a/include/mbgl/android/native_map_view.hpp
+++ b/include/mbgl/android/native_map_view.hpp
@@ -27,7 +27,8 @@ public:
void deactivate() override;
void notify() override;
void invalidate() override;
- void swap() override;
+ void beforeRender() override;
+ void afterRender() override;
void notifyMapChange(mbgl::MapChange) override;
diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp
index 3086d51aab..fadd035e49 100644
--- a/include/mbgl/map/view.hpp
+++ b/include/mbgl/map/view.hpp
@@ -62,8 +62,11 @@ public:
// (map->renderSync() from the main thread must be called as a result of this)
virtual void invalidate() = 0;
+ // Called from the render thread before the render begins.
+ virtual void beforeRender() = 0;
+
// Called from the render thread after the render is complete.
- virtual void swap() = 0;
+ virtual void afterRender() = 0;
// Reads the pixel data from the current framebuffer. If your View implementation
// doesn't support reading from the framebuffer, return a null pointer.
diff --git a/include/mbgl/platform/default/glfw_view.hpp b/include/mbgl/platform/default/glfw_view.hpp
index ec99080732..17050d64db 100644
--- a/include/mbgl/platform/default/glfw_view.hpp
+++ b/include/mbgl/platform/default/glfw_view.hpp
@@ -24,7 +24,8 @@ public:
void deactivate() override;
void notify() override;
void invalidate() override;
- void swap() override;
+ void beforeRender() override;
+ void afterRender() override;
static void onKey(GLFWwindow *window, int key, int scancode, int action, int mods);
static void onScroll(GLFWwindow *window, double xoffset, double yoffset);
diff --git a/include/mbgl/platform/default/headless_view.hpp b/include/mbgl/platform/default/headless_view.hpp
index ce0ff2a685..50edc48428 100644
--- a/include/mbgl/platform/default/headless_view.hpp
+++ b/include/mbgl/platform/default/headless_view.hpp
@@ -37,9 +37,11 @@ public:
void deactivate() override;
void notify() override;
void invalidate() override;
- void swap() override;
+ void beforeRender() override;
+ void afterRender() override;
std::unique_ptr<StillImage> readStillImage() override;
+ void resizeFramebuffer();
void resize(uint16_t width, uint16_t height);
private:
@@ -52,6 +54,7 @@ private:
std::shared_ptr<HeadlessDisplay> display;
const float pixelRatio;
std::array<uint16_t, 2> dimensions;
+ bool needsResize;
#if MBGL_USE_CGL
CGLContextObj glContext = nullptr;