Added Update::Repaint

This commit is contained in:
Bruno de Oliveira Abinader
2015-08-02 22:07:55 +03:00
parent 58357b7964
commit 492bcf0bd7
7 changed files with 19 additions and 15 deletions

View File

@@ -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<NativeMapView *>(nativeMapViewPtr);
nativeMapView->getMap().update();
nativeMapView->getMap().update(mbgl::Update::Repaint);
}
void JNICALL nativeOnInvalidate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jboolean inProgress) {

View File

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

View File

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

View File

@@ -14,6 +14,7 @@ enum class Update : UpdateType {
Classes = 1 << 3,
Zoom = 1 << 4,
RenderStill = 1 << 5,
Repaint = 1 << 6,
};
}

View File

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

View File

@@ -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 {

View File

@@ -396,6 +396,8 @@ void MapContext::setSprite(const std::string& name, std::shared_ptr<const Sprite
void MapContext::onTileDataChanged() {
assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
updated |= static_cast<UpdateType>(Update::Repaint);
asyncUpdate->send();
}