diff --git a/map/screen_coverage.cpp b/map/screen_coverage.cpp index 4c27945196..949a318b3d 100644 --- a/map/screen_coverage.cpp +++ b/map/screen_coverage.cpp @@ -248,13 +248,7 @@ void ScreenCoverage::SetScreen(ScreenBase const & screen) vector newRects; TTileSet tiles; -#ifdef OMIM_OS_IPHONE - int cacheDepthes[] = {0, 1}; -#else - int cacheDepthes[] = {0, 1, 2}; -#endif - - m_tiler.tiles(allRects, cacheDepthes, ARRAY_SIZE(cacheDepthes)); + m_tiler.tiles(allRects, GetPlatform().PreCachingDepth()); TileCache * tileCache = &m_tileRenderer->GetTileCache(); @@ -348,11 +342,7 @@ void ScreenCoverage::SetScreen(ScreenBase const & screen) // if (m_tiler.isLeaf(nr) || (childTilesToDraw > 1)) -#ifdef OMIM_OS_IPHONE - int step = 1; -#else - int step = 2; -#endif + int const step = GetPlatform().PreCachingDepth() - 1; if ((nr.m_tileScale == m_tiler.tileScale() - step) || (nr.m_tileScale == m_tiler.tileScale() )) diff --git a/map/tiler.cpp b/map/tiler.cpp index eacb3ea959..bcc6ef4eb2 100644 --- a/map/tiler.cpp +++ b/map/tiler.cpp @@ -89,7 +89,7 @@ void Tiler::seed(ScreenBase const & screen, m2::PointD const & centerPt, size_t m_tileScale = getTileScale(screen, tileSize); } -void Tiler::tiles(vector & tiles, int const * depthes, unsigned count) +void Tiler::tiles(vector & tiles, int depth) { if (m_tileScale == 0) return; @@ -97,16 +97,12 @@ void Tiler::tiles(vector & tiles, int const * depthes, unsigned count) /// clearing previous coverage tiles.clear(); - int maxDepth = depthes[count - 1]; + if (m_tileScale - depth < 0) + depth = m_tileScale; - for (int j = count - 1; j >= 0; --j) + for (unsigned i = 0; i < depth; ++i) { - int curDepth = depthes[j]; - - if (m_tileScale - curDepth < 0) - curDepth = m_tileScale; - - int pow = maxDepth - curDepth; + int pow = depth - 1 - i; int scale = 1 << pow; diff --git a/map/tiler.hpp b/map/tiler.hpp index ece9b3ead2..e24080977c 100644 --- a/map/tiler.hpp +++ b/map/tiler.hpp @@ -40,7 +40,7 @@ public: /// seed tiler with new screenBase. void seed(ScreenBase const & screenBase, m2::PointD const & centerPt, size_t tileSize); - void tiles(vector & tiles, int const * depthes, unsigned count); + void tiles(vector & tiles, int depth); bool isLeaf(RectInfo const & ri) const; int tileScale() const; diff --git a/platform/platform_ios.mm b/platform/platform_ios.mm index b4d270e15a..1fe47165f8 100644 --- a/platform/platform_ios.mm +++ b/platform/platform_ios.mm @@ -127,7 +127,7 @@ int Platform::VideoMemoryLimit() const int Platform::PreCachingDepth() const { - return 3; + return 2; } string Platform::DeviceName() const