[core] Ensure a non-zero source tile cache size

Previously, for viewport sizes less than 512 pixels in either direction, the computed size was 0.
This commit is contained in:
John Firebaugh
2016-12-12 13:18:03 -08:00
parent 3718e1fa15
commit b0a928dcbc

View File

@@ -141,8 +141,8 @@ void Source::Impl::updateTiles(const UpdateParameters& parameters) {
if (type != SourceType::Annotations && cache.getSize() == 0) {
size_t conservativeCacheSize =
((float)parameters.transformState.getSize().width / util::tileSize) *
((float)parameters.transformState.getSize().height / util::tileSize) *
std::max((float)parameters.transformState.getSize().width / util::tileSize, 1.0f) *
std::max((float)parameters.transformState.getSize().height / util::tileSize, 1.0f) *
(parameters.transformState.getMaxZoom() - parameters.transformState.getMinZoom() + 1) *
0.5;
cache.setSize(conservativeCacheSize);