forked from organicmaps/organicmaps
RemoveActiveTile now only delete tile from active set, not move it to cache.
Second class tiles need move tile to cache after rendering. But after i change logic in TileRenderer second class tile simple deleted
This commit is contained in:
parent
decb2ffd62
commit
c4522f38b6
3 changed files with 14 additions and 24 deletions
|
@ -304,22 +304,6 @@ void ScreenCoverage::SetScreen(ScreenBase const & screen)
|
|||
Tiler::RectInfo nr = newRects[i];
|
||||
//LOG(LDEBUG, ("UVRLOG : NewRect add s=", nr.m_tileScale, " x=", nr.m_x, " y=", nr.m_y, " m_SequenceID=", GetSequenceID()));
|
||||
|
||||
Tiler::RectInfo cr[4] =
|
||||
{
|
||||
Tiler::RectInfo(nr.m_tileScale + 1, nr.m_x * 2, nr.m_y * 2),
|
||||
Tiler::RectInfo(nr.m_tileScale + 1, nr.m_x * 2 + 1, nr.m_y * 2),
|
||||
Tiler::RectInfo(nr.m_tileScale + 1, nr.m_x * 2 + 1, nr.m_y * 2 + 1),
|
||||
Tiler::RectInfo(nr.m_tileScale + 1, nr.m_x * 2, nr.m_y * 2 + 1)
|
||||
};
|
||||
|
||||
int childTilesToDraw = 4;
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
if (drawnTiles.count(cr[i]) || !m_screen.GlobalRect().IsIntersect(m2::AnyRectD(cr[i].m_rect)))
|
||||
--childTilesToDraw;
|
||||
|
||||
// if (m_tiler.isLeaf(nr) || (childTilesToDraw > 1))
|
||||
|
||||
int const step = GetPlatform().PreCachingDepth() - 1;
|
||||
|
||||
if ((nr.m_tileScale == m_tiler.tileScale() - step)
|
||||
|
@ -372,10 +356,9 @@ void ScreenCoverage::SetScreen(ScreenBase const & screen)
|
|||
|
||||
core::CommandsQueue::Chain chain;
|
||||
|
||||
chain.addCommand(bind(&TileRenderer::RemoveActiveTile,
|
||||
chain.addCommand(bind(&TileRenderer::CacheActiveTile,
|
||||
m_tileRenderer,
|
||||
ri,
|
||||
GetSequenceID()));
|
||||
ri));
|
||||
|
||||
if (curNewTile == newRectsCount - 1)
|
||||
chain.addCommand(bind(&CoverageGenerator::AddFinishSequenceTask,
|
||||
|
|
|
@ -344,6 +344,16 @@ Tile const * TileRenderer::GetTile(const Tiler::RectInfo & rectInfo)
|
|||
{
|
||||
TileStructuresLockGuard lock(m_tileCache, m_tileSet);
|
||||
|
||||
CacheActiveTile(rectInfo);
|
||||
|
||||
if (m_tileCache.HasTile(rectInfo))
|
||||
return &m_tileCache.GetTile(rectInfo);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TileRenderer::CacheActiveTile(Tiler::RectInfo const & rectInfo)
|
||||
{
|
||||
if (m_tileSet.HasTile(rectInfo))
|
||||
{
|
||||
ASSERT(!m_tileCache.HasTile(rectInfo), (""));
|
||||
|
@ -360,11 +370,6 @@ Tile const * TileRenderer::GetTile(const Tiler::RectInfo & rectInfo)
|
|||
|
||||
m_tileSet.RemoveTile(rectInfo);
|
||||
}
|
||||
|
||||
if (m_tileCache.HasTile(rectInfo))
|
||||
return &m_tileCache.GetTile(rectInfo);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TileRenderer::WaitForEmptyAndFinished()
|
||||
|
|
|
@ -105,6 +105,8 @@ public:
|
|||
TileCache & GetTileCache();
|
||||
/// get tile from render if tile already rendered, otherwise return NULL
|
||||
Tile const * GetTile(Tiler::RectInfo const & rectInfo);
|
||||
/// Move active tile to cache if tile alrady rendered
|
||||
void CacheActiveTile(Tiler::RectInfo const & rectInfo);
|
||||
/// wait on a condition variable for an empty queue.
|
||||
void WaitForEmptyAndFinished();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue