diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-08-22 12:27:43 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-09-06 17:26:28 -0700 |
commit | 9cd50a891dbd320e9e4816eef4545e0a41f9ab32 (patch) | |
tree | b424e2dcee3090d9c3f37864112d19799dd9af35 /platform/android/src/map | |
parent | 70a204924552463eaeca975a5dd28c00b21aa53d (diff) | |
download | qtlocation-mapboxgl-upstream/jni.hpp-4.tar.gz |
[android] jni.hpp 4.0.0upstream/jni.hpp-4
Diffstat (limited to 'platform/android/src/map')
-rw-r--r-- | platform/android/src/map/camera_position.cpp | 10 | ||||
-rw-r--r-- | platform/android/src/map/camera_position.hpp | 4 | ||||
-rw-r--r-- | platform/android/src/map/image.cpp | 14 | ||||
-rw-r--r-- | platform/android/src/map/image.hpp | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/platform/android/src/map/camera_position.cpp b/platform/android/src/map/camera_position.cpp index 5700341d65..3caf4ea2f3 100644 --- a/platform/android/src/map/camera_position.cpp +++ b/platform/android/src/map/camera_position.cpp @@ -4,8 +4,8 @@ namespace mbgl { namespace android { -jni::Object<CameraPosition> CameraPosition::New(jni::JNIEnv &env, mbgl::CameraOptions options) { - static auto javaClass = jni::Class<CameraPosition>::Singleton(env); +jni::Local<jni::Object<CameraPosition>> CameraPosition::New(jni::JNIEnv &env, mbgl::CameraOptions options) { + static auto& javaClass = jni::Class<CameraPosition>::Singleton(env); static auto constructor = javaClass.GetConstructor<jni::Object<LatLng>, double, double, double>(env); // wrap LatLng values coming from core @@ -28,14 +28,14 @@ jni::Object<CameraPosition> CameraPosition::New(jni::JNIEnv &env, mbgl::CameraOp return javaClass.New(env, constructor, LatLng::New(env, center), options.zoom.value_or(0), tilt_degrees, bearing_degrees); } -mbgl::CameraOptions CameraPosition::getCameraOptions(jni::JNIEnv& env, jni::Object<CameraPosition> position) { - static auto javaClass = jni::Class<CameraPosition>::Singleton(env); +mbgl::CameraOptions CameraPosition::getCameraOptions(jni::JNIEnv& env, const jni::Object<CameraPosition>& position) { + static auto& javaClass = jni::Class<CameraPosition>::Singleton(env); static auto bearing = javaClass.GetField<jni::jdouble>(env, "bearing"); static auto target = javaClass.GetField<jni::Object<LatLng>>(env, "target"); static auto tilt = javaClass.GetField<jni::jdouble>(env, "tilt"); static auto zoom = javaClass.GetField<jni::jdouble>(env, "zoom"); - auto center = LatLng::getLatLng(env, *jni::SeizeLocal(env, position.Get(env, target))); + auto center = LatLng::getLatLng(env, position.Get(env, target)); return mbgl::CameraOptions { center, diff --git a/platform/android/src/map/camera_position.hpp b/platform/android/src/map/camera_position.hpp index d577811915..7579f9fed1 100644 --- a/platform/android/src/map/camera_position.hpp +++ b/platform/android/src/map/camera_position.hpp @@ -12,9 +12,9 @@ class CameraPosition : private mbgl::util::noncopyable { public: static constexpr auto Name() { return "com/mapbox/mapboxsdk/camera/CameraPosition"; }; - static jni::Object<CameraPosition> New(jni::JNIEnv&, mbgl::CameraOptions); + static jni::Local<jni::Object<CameraPosition>> New(jni::JNIEnv&, mbgl::CameraOptions); - static mbgl::CameraOptions getCameraOptions(jni::JNIEnv&, jni::Object<CameraPosition>); + static mbgl::CameraOptions getCameraOptions(jni::JNIEnv&, const jni::Object<CameraPosition>&); static void registerNative(jni::JNIEnv&); }; diff --git a/platform/android/src/map/image.cpp b/platform/android/src/map/image.cpp index ee3c7012a7..a91cc938ed 100644 --- a/platform/android/src/map/image.cpp +++ b/platform/android/src/map/image.cpp @@ -5,8 +5,8 @@ namespace mbgl { namespace android { -mbgl::style::Image Image::getImage(jni::JNIEnv& env, jni::Object<Image> image) { - static auto javaClass = jni::Class<Image>::Singleton(env); +mbgl::style::Image Image::getImage(jni::JNIEnv& env, const jni::Object<Image>& image) { + static auto& javaClass = jni::Class<Image>::Singleton(env); static auto widthField = javaClass.GetField<jni::jint>(env, "width"); static auto heightField = javaClass.GetField<jni::jint>(env, "height"); static auto pixelRatioField = javaClass.GetField<jni::jfloat>(env, "pixelRatio"); @@ -17,19 +17,19 @@ mbgl::style::Image Image::getImage(jni::JNIEnv& env, jni::Object<Image> image) { auto height = image.Get(env, heightField); auto width = image.Get(env, widthField); auto pixelRatio = image.Get(env, pixelRatioField); - auto pixels = jni::SeizeLocal(env, image.Get(env, bufferField)); - auto name = jni::Make<std::string>(env, *jni::SeizeLocal(env, image.Get(env, nameField))); + auto pixels = image.Get(env, bufferField); + auto name = jni::Make<std::string>(env, image.Get(env, nameField)); auto sdf = (bool) image.Get(env, sdfField); - jni::NullCheck(env, pixels->Get()); - std::size_t size = pixels->Length(env); + jni::NullCheck(env, pixels.get()); + std::size_t size = pixels.Length(env); mbgl::PremultipliedImage premultipliedImage({ static_cast<uint32_t>(width), static_cast<uint32_t>(height) }); if (premultipliedImage.bytes() != uint32_t(size)) { throw mbgl::util::SpriteImageException("Sprite image pixel count mismatch"); } - jni::GetArrayRegion(env, **pixels, 0, size, reinterpret_cast<jbyte*>(premultipliedImage.data.get())); + jni::GetArrayRegion(env, *pixels, 0, size, reinterpret_cast<jbyte*>(premultipliedImage.data.get())); return mbgl::style::Image {name, std::move(premultipliedImage), pixelRatio, sdf}; } diff --git a/platform/android/src/map/image.hpp b/platform/android/src/map/image.hpp index 17ed4cbef8..7549bc646a 100644 --- a/platform/android/src/map/image.hpp +++ b/platform/android/src/map/image.hpp @@ -12,7 +12,7 @@ class Image : private mbgl::util::noncopyable { public: static constexpr auto Name() { return "com/mapbox/mapboxsdk/maps/Image"; }; - static mbgl::style::Image getImage(jni::JNIEnv&, jni::Object<Image>); + static mbgl::style::Image getImage(jni::JNIEnv&, const jni::Object<Image>&); static void registerNative(jni::JNIEnv&); }; |