forked from organicmaps/organicmaps
improving responsiveness of tile rendering while zooming.
This commit is contained in:
parent
1f62143e3b
commit
b128666a04
4 changed files with 32 additions and 3 deletions
|
@ -69,7 +69,10 @@ void CoverageGenerator::AddCoverScreenTask(ScreenBase const & screen)
|
|||
return;
|
||||
|
||||
m_currentScreen = screen;
|
||||
|
||||
m_queue.Clear();
|
||||
m_sequenceID++;
|
||||
m_queue.CancelCommands();
|
||||
|
||||
m_queue.AddCommand(bind(&CoverageGenerator::CoverScreen, this, screen, m_sequenceID));
|
||||
}
|
||||
|
|
|
@ -201,12 +201,16 @@ void ScreenCoverage::SetScreen(ScreenBase const & screen, bool /*mergePathNames*
|
|||
m_stylesCache->upload();
|
||||
}
|
||||
|
||||
/// clearing all old commands
|
||||
m_tileRenderer->ClearCommands();
|
||||
/// setting new sequenceID
|
||||
m_tileRenderer->SetSequenceID(m_tiler.sequenceID());
|
||||
/// cancelling commands in progress
|
||||
m_tileRenderer->CancelCommands();
|
||||
/// adding commands for tiles which aren't in cache
|
||||
for (size_t i = 0; i < newRects.size(); ++i)
|
||||
{
|
||||
m_tileRenderer->AddCommand(newRects[i], m_tiler.sequenceID(),
|
||||
bind(&CoverageGenerator::AddMergeTileTask, m_coverageGenerator, newRects[i]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ void TileRenderer::DrawTile(core::CommandsQueue::Environment const & env,
|
|||
|
||||
void TileRenderer::AddCommand(Tiler::RectInfo const & rectInfo, int sequenceID, core::CommandsQueue::Chain const & afterTileFns)
|
||||
{
|
||||
m_sequenceID = sequenceID;
|
||||
SetSequenceID(sequenceID);
|
||||
|
||||
core::CommandsQueue::Chain chain;
|
||||
chain.addCommand(bind(&TileRenderer::DrawTile, this, _1, rectInfo, sequenceID));
|
||||
|
@ -196,6 +196,21 @@ void TileRenderer::AddCommand(Tiler::RectInfo const & rectInfo, int sequenceID,
|
|||
m_queue.AddCommand(chain);
|
||||
}
|
||||
|
||||
void TileRenderer::CancelCommands()
|
||||
{
|
||||
m_queue.CancelCommands();
|
||||
}
|
||||
|
||||
void TileRenderer::ClearCommands()
|
||||
{
|
||||
m_queue.Clear();
|
||||
}
|
||||
|
||||
void TileRenderer::SetSequenceID(int sequenceID)
|
||||
{
|
||||
m_sequenceID = sequenceID;
|
||||
}
|
||||
|
||||
TileCache & TileRenderer::GetTileCache()
|
||||
{
|
||||
return m_tileCache;
|
||||
|
@ -227,3 +242,4 @@ void TileRenderer::AddTile(Tiler::RectInfo const & rectInfo, Tile const & tile)
|
|||
m_tileCache.writeUnlock();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -87,6 +87,12 @@ public:
|
|||
/// wait on a condition variable for an empty queue.
|
||||
void WaitForEmptyAndFinished();
|
||||
|
||||
void SetSequenceID(int sequenceID);
|
||||
|
||||
void CancelCommands();
|
||||
|
||||
void ClearCommands();
|
||||
|
||||
bool HasTile(Tiler::RectInfo const & rectInfo);
|
||||
void AddTile(Tiler::RectInfo const & rectInfo, Tile const & tile);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue