diff options
Diffstat (limited to 'platform/android/src')
-rwxr-xr-x | platform/android/src/jni.cpp | 10 | ||||
-rwxr-xr-x | platform/android/src/native_map_view.cpp | 18 |
2 files changed, 16 insertions, 12 deletions
diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp index 6dcd177cd6..01d3a01227 100755 --- a/platform/android/src/jni.cpp +++ b/platform/android/src/jni.cpp @@ -833,9 +833,10 @@ void nativeAddAnnotationIcon(JNIEnv *env, jni::jobject* obj, jlong nativeMapView NullCheck(*env, jpixels); std::size_t size = jni::GetArrayLength(*env, *jpixels); - mbgl::PremultipliedImage premultipliedImage(width, height); + mbgl::PremultipliedImage premultipliedImage( + { static_cast<uint32_t>(width), static_cast<uint32_t>(height) }); - if (premultipliedImage.size() != uint32_t(size)) { + if (premultipliedImage.bytes() != uint32_t(size)) { throw mbgl::util::SpriteImageException("Sprite image pixel count mismatch"); } @@ -1162,9 +1163,10 @@ void nativeAddImage(JNIEnv *env, jni::jobject* obj, jlong nativeMapViewPtr, jni: // Create Pre-multiplied image from byte[] NullCheck(*env, data); std::size_t size = jni::GetArrayLength(*env, *data); - mbgl::PremultipliedImage premultipliedImage(width, height); + mbgl::PremultipliedImage premultipliedImage( + { static_cast<uint32_t>(width), static_cast<uint32_t>(height) }); - if (premultipliedImage.size() != uint32_t(size)) { + if (premultipliedImage.bytes() != uint32_t(size)) { throw mbgl::util::SpriteImageException("Sprite image pixel count mismatch"); } diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 8f594f2c0e..9943dafe36 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -83,15 +83,14 @@ NativeMapView::NativeMapView(JNIEnv *env_, jobject obj_, float pixelRatio, int a mbgl::android::apkPath); map = std::make_unique<mbgl::Map>( - *this, - std::array<uint16_t, 2>{{ static_cast<uint16_t>(width), static_cast<uint16_t>(height) }}, + *this, mbgl::Size{ static_cast<uint32_t>(width), static_cast<uint32_t>(height) }, pixelRatio, *fileSource, threadPool, MapMode::Continuous); float zoomFactor = map->getMaxZoom() - map->getMinZoom() + 1; float cpuFactor = availableProcessors; float memoryFactor = static_cast<float>(totalMemory) / 1000.0f / 1000.0f / 1000.0f; - float sizeFactor = (static_cast<float>(map->getWidth()) / mbgl::util::tileSize) * - (static_cast<float>(map->getHeight()) / mbgl::util::tileSize); + float sizeFactor = (static_cast<float>(map->getSize().width) / mbgl::util::tileSize) * + (static_cast<float>(map->getSize().height) / mbgl::util::tileSize); size_t cacheSize = zoomFactor * cpuFactor * memoryFactor * sizeFactor * 0.5f; @@ -119,12 +118,15 @@ NativeMapView::~NativeMapView() { void NativeMapView::updateViewBinding() { getContext().bindFramebuffer.setCurrentValue(0); - getContext().viewport.setCurrentValue({ 0, 0, static_cast<uint16_t>(fbWidth), static_cast<uint16_t>(fbHeight) }); + getContext().viewport.setCurrentValue( + { 0, 0, { static_cast<uint32_t>(fbWidth), static_cast<uint32_t>(fbHeight) } }); } void NativeMapView::bind() { getContext().bindFramebuffer = 0; - getContext().viewport = { 0, 0, static_cast<uint16_t>(fbWidth), static_cast<uint16_t>(fbHeight) }; + getContext().viewport = { 0, + 0, + { static_cast<uint32_t>(fbWidth), static_cast<uint32_t>(fbHeight) } }; } void NativeMapView::activate() { @@ -201,7 +203,7 @@ void NativeMapView::render() { // take snapshot const unsigned int w = fbWidth; const unsigned int h = fbHeight; - mbgl::PremultipliedImage image { static_cast<uint16_t>(w), static_cast<uint16_t>(h) }; + mbgl::PremultipliedImage image({ w, h }); MBGL_CHECK_ERROR(glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, image.data.get())); const size_t stride = image.stride(); auto tmp = std::make_unique<uint8_t[]>(stride); @@ -718,7 +720,7 @@ void NativeMapView::updateFps() { void NativeMapView::resizeView(int w, int h) { width = w; height = h; - map->setSize({{ static_cast<uint16_t>(width), static_cast<uint16_t>(height) }}); + map->setSize({ static_cast<uint32_t>(width), static_cast<uint32_t>(height) }); } void NativeMapView::resizeFramebuffer(int w, int h) { |