Merge branch 'master' of github.com:mapbox/mapbox-gl-native

This commit is contained in:
Brad Leege
2015-08-05 15:53:50 -05:00
18 changed files with 111 additions and 89 deletions

View File

@@ -409,14 +409,14 @@ 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) {
void JNICALL nativeOnInvalidate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeOnInvalidate");
assert(nativeMapViewPtr != 0);
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
nativeMapView->onInvalidate(inProgress);
nativeMapView->onInvalidate();
}
void JNICALL nativeViewResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint width, jint height) {
@@ -1440,7 +1440,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
{"nativePause", "(J)V", reinterpret_cast<void *>(&nativePause)},
{"nativeResume", "(J)V", reinterpret_cast<void *>(&nativeResume)},
{"nativeUpdate", "(J)V", reinterpret_cast<void *>(&nativeUpdate)},
{"nativeOnInvalidate", "(JZ)V", reinterpret_cast<void *>(&nativeOnInvalidate)},
{"nativeOnInvalidate", "(J)V", reinterpret_cast<void *>(&nativeOnInvalidate)},
{"nativeViewResize", "(JII)V",
reinterpret_cast<void *>(static_cast<void JNICALL (
*)(JNIEnv *, jobject, jlong, jint, jint)>(&nativeViewResize))},

View File

@@ -761,7 +761,7 @@ void NativeMapView::updateFps() {
env = nullptr;
}
void NativeMapView::onInvalidate(bool inProgress) {
void NativeMapView::onInvalidate() {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::onInvalidate()");
const bool dirty = !clean.test_and_set();
@@ -776,10 +776,8 @@ void NativeMapView::onInvalidate(bool inProgress) {
map.setSourceTileCacheSize(cacheSize);
const bool needsRerender = map.renderSync();
if (!inProgress) {
map.nudgeTransitions(needsRerender);
}
map.renderSync();
map.nudgeTransitions();
}
}
@@ -792,6 +790,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

@@ -1365,8 +1365,7 @@ public class MapView extends FrameLayout implements LocationListener {
post(new Runnable() {
@Override
public void run() {
boolean inProgress = mRotateGestureDetector.isInProgress() || mScaleGestureDetector.isInProgress();
mNativeMapView.invalidate(inProgress);
mNativeMapView.invalidate();
}
});
}

View File

@@ -96,8 +96,8 @@ class NativeMapView {
nativeUpdate(mNativeMapViewPtr);
}
public void invalidate(boolean inProgress) {
nativeOnInvalidate(mNativeMapViewPtr, inProgress);
public void invalidate() {
nativeOnInvalidate(mNativeMapViewPtr);
}
public void resizeView(int width, int height) {
@@ -463,7 +463,7 @@ class NativeMapView {
private native void nativeUpdate(long nativeMapViewPtr);
private native void nativeOnInvalidate(long nativeMapViewPtr, boolean inProgress);
private native void nativeOnInvalidate(long nativeMapViewPtr);
private native void nativeViewResize(long nativeMapViewPtr, int width, int height);