diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/src/native_map_view.cpp | 29 | ||||
-rw-r--r-- | platform/android/src/test/render_test_runner.cpp | 10 |
2 files changed, 19 insertions, 20 deletions
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 617f633699..554a59de76 100644 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -61,12 +61,9 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env, const jni::Object<NativeMapView>& _obj, const jni::Object<FileSource>& jFileSource, const jni::Object<MapRenderer>& jMapRenderer, - jni::jfloat _pixelRatio, - jni::jboolean _crossSourceCollisions) - : javaPeer(_env, _obj) - , mapRenderer(MapRenderer::getNativePeer(_env, jMapRenderer)) - , pixelRatio(_pixelRatio) { - + jni::jfloat pixelRatio_, + jni::jboolean crossSourceCollisions_) + : javaPeer(_env, _obj), mapRenderer(MapRenderer::getNativePeer(_env, jMapRenderer)), pixelRatio(pixelRatio_) { // Get a reference to the JavaVM for callbacks if (_env.GetJavaVM(&vm) < 0) { _env.ExceptionDescribe(); @@ -79,11 +76,11 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env, // Create Map options MapOptions options; options.withMapMode(MapMode::Continuous) - .withSize(mbgl::Size{ static_cast<uint32_t>(width), static_cast<uint32_t>(height) }) - .withPixelRatio(pixelRatio) - .withConstrainMode(ConstrainMode::HeightOnly) - .withViewportMode(ViewportMode::Default) - .withCrossSourceCollisions(_crossSourceCollisions); + .withSize(mbgl::Size{static_cast<uint32_t>(width), static_cast<uint32_t>(height)}) + .withPixelRatio(pixelRatio) + .withConstrainMode(ConstrainMode::HeightOnly) + .withViewportMode(ViewportMode::Default) + .withCrossSourceCollisions(crossSourceCollisions_); // Create the core map map = std::make_unique<mbgl::Map>( @@ -624,7 +621,7 @@ jni::Local<jni::Object<PointF>> NativeMapView::pixelForLatLng(JNIEnv& env, jdoub void NativeMapView::pixelsForLatLngs(JNIEnv& env, const jni::Array<jdouble>& input, jni::Array<jdouble>& output, - jfloat pixelRatio) { + jfloat pixelRatio_) { jni::NullCheck(env, &input); std::size_t len = input.Length(env); @@ -640,8 +637,8 @@ void NativeMapView::pixelsForLatLngs(JNIEnv& env, buffer.reserve(len); std::vector<ScreenCoordinate> coordinates = map->pixelsForLatLngs(latLngs); for (std::size_t i = 0; i < len / 2; i++) { - buffer.push_back(coordinates[i].x * pixelRatio); - buffer.push_back(coordinates[i].y * pixelRatio); + buffer.push_back(coordinates[i].x * pixelRatio_); + buffer.push_back(coordinates[i].y * pixelRatio_); } output.SetRegion<std::vector<jdouble>>(env, 0, buffer); @@ -654,7 +651,7 @@ jni::Local<jni::Object<LatLng>> NativeMapView::latLngForPixel(JNIEnv& env, jfloa void NativeMapView::latLngsForPixels(JNIEnv& env, const jni::Array<jdouble>& input, jni::Array<jdouble>& output, - jfloat pixelRatio) { + jfloat pixelRatio_) { jni::NullCheck(env, &input); std::size_t len = input.Length(env); @@ -662,7 +659,7 @@ void NativeMapView::latLngsForPixels(JNIEnv& env, coordinates.reserve(len); for (std::size_t i = 0; i < len; i += 2) { - auto coordinate = mbgl::ScreenCoordinate(input.Get(env, i) / pixelRatio, input.Get(env, i + 1) / pixelRatio); + auto coordinate = mbgl::ScreenCoordinate(input.Get(env, i) / pixelRatio_, input.Get(env, i + 1) / pixelRatio_); coordinates.push_back(coordinate); } diff --git a/platform/android/src/test/render_test_runner.cpp b/platform/android/src/test/render_test_runner.cpp index cc0d2042c5..e738d7a8bc 100644 --- a/platform/android/src/test/render_test_runner.cpp +++ b/platform/android/src/test/render_test_runner.cpp @@ -196,20 +196,22 @@ void unZipFile(JNIEnv* env, const std::string& zipFilePath, const std::string& d if (!(env->CallBooleanMethod(f, fileIsDirectory))) { jmethodID mkdirs = env->GetMethodID(fileClass, "mkdirs", "()Z"); bool success = (env->CallBooleanMethod(f, mkdirs)); - std::string fileName = + std::string fileNameStr = jstringToStdString(env, static_cast<jstring>(env->CallObjectMethod(f, fileGetName))); if (!success) { mbgl::Log::Warning( - mbgl::Event::General, "Failed to create folder entry %s from zip", fileName.c_str()); + mbgl::Event::General, "Failed to create folder entry %s from zip", fileNameStr.c_str()); } } } else if (!(env->CallBooleanMethod(f, fileExists))) { bool success = env->CallBooleanMethod(f, createNewFile); - std::string fileName = jstringToStdString(env, static_cast<jstring>(env->CallObjectMethod(f, fileGetName))); + std::string fileNameStr = + jstringToStdString(env, static_cast<jstring>(env->CallObjectMethod(f, fileGetName))); if (!success) { - mbgl::Log::Warning(mbgl::Event::General, "Failed to create folder entry %s from zip", fileName.c_str()); + mbgl::Log::Warning( + mbgl::Event::General, "Failed to create folder entry %s from zip", fileNameStr.c_str()); continue; } |