diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index eee6bd8f6..476d43729 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -409,7 +409,7 @@ void JNICALL nativeUpdate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeUpdate"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); - nativeMapView->getMap().update(); + nativeMapView->getMap().update(mbgl::Update::Repaint); } void JNICALL nativeOnInvalidate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jboolean inProgress) { diff --git a/android/cpp/native_map_view.cpp b/android/cpp/native_map_view.cpp index 351833a07..9a24bddfe 100644 --- a/android/cpp/native_map_view.cpp +++ b/android/cpp/native_map_view.cpp @@ -792,6 +792,7 @@ void NativeMapView::resizeView(int w, int h) { void NativeMapView::resizeFramebuffer(int w, int h) { fbWidth = w; fbHeight = h; + map.update(mbgl::Update::Repaint); } } diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 6e24d177a..e35a738d6 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -73,7 +73,7 @@ public: void nudgeTransitions(bool forceRerender); // Notifies the Map thread that the state has changed and an update might be necessary. - void update(Update update = Update::Nothing); + void update(Update update); // Styling void addClass(const std::string&); diff --git a/include/mbgl/map/update.hpp b/include/mbgl/map/update.hpp index d2d6133bc..d5978d80b 100644 --- a/include/mbgl/map/update.hpp +++ b/include/mbgl/map/update.hpp @@ -14,6 +14,7 @@ enum class Update : UpdateType { Classes = 1 << 3, Zoom = 1 << 4, RenderStill = 1 << 5, + Repaint = 1 << 6, }; } diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index fb08b9234..8336b3293 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -288,7 +288,7 @@ void GLFWView::onFramebufferResize(GLFWwindow *window, int width, int height) { view->fbWidth = width; view->fbHeight = height; - view->map->update(); + view->map->update(mbgl::Update::Repaint); } void GLFWView::onMouseClick(GLFWwindow *window, int button, int action, int modifiers) { diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index d2cd7a53b..4990d24fc 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -110,24 +110,24 @@ std::string Map::getStyleJSON() const { void Map::cancelTransitions() { transform->cancelTransitions(); - update(); + update(Update::Repaint); } void Map::setGestureInProgress(bool inProgress) { transform->setGestureInProgress(inProgress); - update(); + update(Update::Repaint); } #pragma mark - Position void Map::moveBy(double dx, double dy, const Duration& duration) { transform->moveBy(dx, dy, duration); - update(); + update(Update::Repaint); } void Map::setLatLng(LatLng latLng, const Duration& duration) { transform->setLatLng(latLng, duration); - update(); + update(Update::Repaint); } LatLng Map::getLatLng() const { @@ -249,17 +249,17 @@ uint16_t Map::getHeight() const { void Map::rotateBy(double sx, double sy, double ex, double ey, const Duration& duration) { transform->rotateBy(sx, sy, ex, ey, duration); - update(); + update(Update::Repaint); } void Map::setBearing(double degrees, const Duration& duration) { transform->setAngle(-degrees * M_PI / 180, duration); - update(); + update(Update::Repaint); } void Map::setBearing(double degrees, double cx, double cy) { transform->setAngle(-degrees * M_PI / 180, cx, cy); - update(); + update(Update::Repaint); } double Map::getBearing() const { @@ -268,7 +268,7 @@ double Map::getBearing() const { void Map::resetNorth() { transform->setAngle(0, std::chrono::milliseconds(500)); - update(); + update(Update::Repaint); } @@ -365,12 +365,12 @@ void Map::removeSprite(const std::string& name) { void Map::setDebug(bool value) { data->setDebug(value); - update(); + update(Update::Repaint); } void Map::toggleDebug() { data->toggleDebug(); - update(); + update(Update::Repaint); } bool Map::getDebug() const { @@ -379,12 +379,12 @@ bool Map::getDebug() const { void Map::setCollisionDebug(bool value) { data->setCollisionDebug(value); - update(); + update(Update::Repaint); } void Map::toggleCollisionDebug() { data->toggleCollisionDebug(); - update(); + update(Update::Repaint); } bool Map::getCollisionDebug() const { diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index f6a6462c4..c5a0ee07a 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -396,6 +396,8 @@ void MapContext::setSprite(const std::string& name, std::shared_ptr(Update::Repaint); asyncUpdate->send(); }