diff options
author | Leith Bade <leith@mapbox.com> | 2014-11-26 23:47:37 +1100 |
---|---|---|
committer | Leith Bade <leith@mapbox.com> | 2014-11-28 00:19:11 +1100 |
commit | b1c793d1e00c470b86c8750b51c1b15beaeaecd7 (patch) | |
tree | 343133fca3af457676975eb439691912b4f79863 /android/cpp/jni.cpp | |
parent | b07a6ba9ee71255e3d1c87f92ccdc5a0c0d6589c (diff) | |
download | qtlocation-mapboxgl-b1c793d1e00c470b86c8750b51c1b15beaeaecd7.tar.gz |
Add fps mode for #646
Diffstat (limited to 'android/cpp/jni.cpp')
-rw-r--r-- | android/cpp/jni.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index a406e83c06..41af8ae3cf 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -30,6 +30,7 @@ std::string data_path; std::string apk_path; jmethodID on_map_changed_id = nullptr; +jmethodID on_fps_changed_id = nullptr; jclass lon_lat_class = nullptr; jmethodID lon_lat_constructor_id = nullptr; @@ -665,14 +666,14 @@ void JNICALL nativeSetDebug(JNIEnv* env, jobject obj, jlong native_map_view_ptr, mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetDebug"); assert(native_map_view_ptr != 0); NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr); - COFFEE_TRY_JNI(env, native_map_view->getMap().setDebug(debug)); + COFFEE_TRY_JNI(env, native_map_view->getMap().setDebug(debug); native_map_view->enableFps(debug)); } void JNICALL nativeToggleDebug(JNIEnv* env, jobject obj, jlong native_map_view_ptr) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeToggleDebug"); assert(native_map_view_ptr != 0); NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr); - COFFEE_TRY_JNI(env, native_map_view->getMap().toggleDebug()); + COFFEE_TRY_JNI(env, native_map_view->getMap().toggleDebug(); native_map_view->enableFps(native_map_view->getMap().getDebug())); } jboolean JNICALL nativeGetDebug(JNIEnv* env, jobject obj, jlong native_map_view_ptr) { @@ -773,6 +774,12 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + on_fps_changed_id = env->GetMethodID(native_map_view_class, "onFpsChanged", "(D)V"); + if (on_fps_changed_id == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + runtime_exception_class = env->FindClass("java/lang/RuntimeException"); if (runtime_exception_class == nullptr) { env->ExceptionDescribe(); @@ -951,6 +958,7 @@ extern "C" JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { lon_lat_zoom_zoom_id = nullptr; on_map_changed_id = nullptr; + on_fps_changed_id = nullptr; env->DeleteGlobalRef(runtime_exception_class); runtime_exception_class = nullptr; |