diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-02-05 14:58:20 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-03-06 13:52:25 +0100 |
commit | fb44fc81bdab09d079ed27e22b86718627ded48b (patch) | |
tree | 2a4e7c80eb49624c0b548d7bd33401792da1faa4 /android | |
parent | 0151fe6c01367ef03a2ff282b90e32dd3785a7c2 (diff) | |
download | qtlocation-mapboxgl-fb44fc81bdab09d079ed27e22b86718627ded48b.tar.gz |
make Map::resize() private
they can only be called by View::resize
Diffstat (limited to 'android')
-rw-r--r-- | android/cpp/jni.cpp | 20 | ||||
-rw-r--r-- | android/cpp/native_map_view.cpp | 5 | ||||
-rw-r--r-- | android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java | 29 |
3 files changed, 7 insertions, 47 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 37c790a426..1163c33b57 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -327,18 +327,6 @@ void JNICALL nativeSwapped(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { } void JNICALL nativeResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint width, jint height, - jfloat ratio) { - mbgl::Log::Debug(mbgl::Event::JNI, "nativeResize"); - assert(nativeMapViewPtr != 0); - assert(width >= 0); - assert(height >= 0); - assert(width <= UINT16_MAX); - assert(height <= UINT16_MAX); - NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - nativeMapView->getMap().resize(width, height, ratio); -} - -void JNICALL nativeResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint width, jint height, jfloat ratio, jint fbWidth, jint fbHeight) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeResize"); assert(nativeMapViewPtr != 0); @@ -351,7 +339,7 @@ void JNICALL nativeResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint assert(fbWidth <= UINT16_MAX); assert(fbHeight <= UINT16_MAX); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - nativeMapView->getMap().resize(width, height, ratio, fbWidth, fbHeight); + nativeMapView->resize(width, height, ratio, fbWidth, fbHeight); } void JNICALL nativeRemoveClass(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring clazz) { @@ -1014,7 +1002,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { // NOTE: if you get java.lang.UnsatisfiedLinkError you likely forgot to set the size of the // array correctly (too large) - std::array<JNINativeMethod, 67> methods = {{ // Can remove the extra brace in C++14 + std::array<JNINativeMethod, 66> methods = {{ // Can remove the extra brace in C++14 {"nativeCreate", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J", reinterpret_cast<void *>(&nativeCreate)}, {"nativeDestroy", "(J)V", reinterpret_cast<void *>(&nativeDestroy)}, @@ -1035,10 +1023,6 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { {"nativeTerminate", "(J)V", reinterpret_cast<void *>(&nativeTerminate)}, {"nativeNeedsSwap", "(J)Z", reinterpret_cast<void *>(&nativeNeedsSwap)}, {"nativeSwapped", "(J)V", reinterpret_cast<void *>(&nativeSwapped)}, - {"nativeResize", "(JIIF)V", - reinterpret_cast<void *>( - static_cast<void JNICALL (*)(JNIEnv *, jobject, jlong, jint, jint, jfloat)>( - &nativeResize))}, {"nativeResize", "(JIIFII)V", reinterpret_cast<void *>(static_cast<void JNICALL ( *)(JNIEnv *, jobject, jlong, jint, jint, jfloat, jint, jint)>(&nativeResize))}, diff --git a/android/cpp/native_map_view.cpp b/android/cpp/native_map_view.cpp index cd3445e24e..599f245989 100644 --- a/android/cpp/native_map_view.cpp +++ b/android/cpp/native_map_view.cpp @@ -823,5 +823,10 @@ void NativeMapView::updateFps() { } env = nullptr; } + +void NativeMapView::resize(uint16_t width, uint16_t height, float ratio, uint16_t fbWidth, uint16_t fbHeight) { + View::resize(width, height, ratio, fbWidth, fbHeight); +} + } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index ffb439737e..a73a89d2d7 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -113,32 +113,6 @@ class NativeMapView { nativeSwapped(mNativeMapViewPtr); } - public void resize(int width, int height) { - resize(width, height, 1.0f); - } - - public void resize(int width, int height, float ratio) { - if (width < 0) { - throw new IllegalArgumentException("width cannot be negative."); - } - - if (height < 0) { - throw new IllegalArgumentException("height cannot be negative."); - } - - if (width > 65535) { - throw new IllegalArgumentException( - "width cannot be greater than 65535."); - } - - if (height > 65535) { - throw new IllegalArgumentException( - "height cannot be greater than 65535."); - } - - nativeResize(mNativeMapViewPtr, width, height, ratio); - } - public void resize(int width, int height, float ratio, int fbWidth, int fbHeight) { if (width < 0) { @@ -477,9 +451,6 @@ class NativeMapView { private native void nativeSwapped(long nativeMapViewPtr); private native void nativeResize(long nativeMapViewPtr, int width, - int height, float ratio); - - private native void nativeResize(long nativeMapViewPtr, int width, int height, float ratio, int fbWidth, int fbHeight); private native void nativeAddClass(long nativeMapViewPtr, String clazz); |