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/image.cpp | |
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/image.cpp')
-rw-r--r-- | platform/android/src/map/image.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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}; } |