From 407fbc70b1dc6dab6b7aa5a4b9c57b4e08906c79 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Sun, 15 Jan 2017 11:27:52 -0500 Subject: [core] Prefetch low resolution tiles --- include/mbgl/map/map.hpp | 9 +++++++++ include/mbgl/util/constants.hpp | 2 ++ 2 files changed, 11 insertions(+) (limited to 'include') diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 1b45c87c28..158e9d733d 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -156,6 +156,15 @@ public: AnnotationIDs queryPointAnnotations(const ScreenBox&); + // Tile prefetching + // + // When loading a map, if `PrefetchZoomDelta` is set to any number greater than 0, the map will + // first request a tile for `zoom = getZoom() - delta` in a attempt to display a full map at + // lower resolution as quick as possible. It will get clamped at the tile source minimum zoom. + // The default `delta` is 4. + void setPrefetchZoomDelta(uint8_t delta); + uint8_t getPrefetchZoomDelta() const; + // Memory void onLowMemory(); diff --git a/include/mbgl/util/constants.hpp b/include/mbgl/util/constants.hpp index 14aaa752bc..c2250c6f2e 100644 --- a/include/mbgl/util/constants.hpp +++ b/include/mbgl/util/constants.hpp @@ -38,6 +38,8 @@ constexpr double MAX_ZOOM = 25.5; constexpr float MIN_ZOOM_F = MIN_ZOOM; constexpr float MAX_ZOOM_F = MAX_ZOOM; +constexpr uint8_t DEFAULT_PREFETCH_ZOOM_DELTA = 4; + constexpr uint64_t DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024; constexpr Duration DEFAULT_TRANSITION_DURATION = Milliseconds(300); -- cgit v1.2.1