summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-06 15:50:41 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-10 18:01:28 +0300
commit3ad527a59ddb83d2a5add7b4c2678559b4678697 (patch)
tree07c9cbf8d01c20874d60f9575343bce678693f4f /platform
parentf1bcca1465b5824c425b395ee6700a1431ca5509 (diff)
downloadqtlocation-mapboxgl-3ad527a59ddb83d2a5add7b4c2678559b4678697.tar.gz
[android] Recalculate source tile cache size when appropiate
Diffstat (limited to 'platform')
-rwxr-xr-xplatform/android/src/native_map_view.cpp7
-rwxr-xr-xplatform/android/src/native_map_view.hpp1
2 files changed, 8 insertions, 0 deletions
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index 9f6328cd51..5e202221b6 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -73,6 +73,10 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env,
MapMode::Continuous, GLContextMode::Unique, ConstrainMode::HeightOnly,
ViewportMode::Default, jni::Make<std::string>(_env, _programCacheDir));
+ recalculateSourceTileCacheSize();
+}
+
+void NativeMapView::recalculateSourceTileCacheSize() {
//Calculate a fitting cache size based on device parameters
float zoomFactor = map->getMaxZoom() - map->getMinZoom() + 1;
float cpuFactor = availableProcessors;
@@ -324,6 +328,7 @@ void NativeMapView::resizeView(jni::JNIEnv&, int w, int h) {
width = util::max(64, w);
height = util::max(64, h);
map->setSize({ static_cast<uint32_t>(width), static_cast<uint32_t>(height) });
+ recalculateSourceTileCacheSize();
}
void NativeMapView::resizeFramebuffer(jni::JNIEnv&, int w, int h) {
@@ -480,6 +485,7 @@ void NativeMapView::resetZoom(jni::JNIEnv&) {
void NativeMapView::setMinZoom(jni::JNIEnv&, jni::jdouble zoom) {
map->setMinZoom(zoom);
+ recalculateSourceTileCacheSize();
}
jni::jdouble NativeMapView::getMinZoom(jni::JNIEnv&) {
@@ -488,6 +494,7 @@ jni::jdouble NativeMapView::getMinZoom(jni::JNIEnv&) {
void NativeMapView::setMaxZoom(jni::JNIEnv&, jni::jdouble zoom) {
map->setMaxZoom(zoom);
+ recalculateSourceTileCacheSize();
}
jni::jdouble NativeMapView::getMaxZoom(jni::JNIEnv&) {
diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp
index 770065a8a3..de98e6313e 100755
--- a/platform/android/src/native_map_view.hpp
+++ b/platform/android/src/native_map_view.hpp
@@ -287,6 +287,7 @@ private:
void updateFps();
private:
+ void recalculateSourceTileCacheSize();
JavaVM *vm = nullptr;
jni::UniqueWeakObject<NativeMapView> javaPeer;