forked from organicmaps/organicmaps
fixes according to code review.
This commit is contained in:
parent
e1c192c9c5
commit
32c7a64f5b
5 changed files with 23 additions and 8 deletions
|
@ -19,15 +19,21 @@ BasicTilingRenderPolicy::BasicTilingRenderPolicy(Params const & p,
|
|||
m_IsNavigating(false)
|
||||
{
|
||||
/// calculating TileSize based on p.m_screenWidth and p.m_screenHeight
|
||||
/// ceiling screen sizes to the nearest power of two, and taking half of it as a tile size
|
||||
/// choosing the maximum screen size, rounding it to the power of two
|
||||
/// and taking half of result as a tile size.
|
||||
double const log2 = log(2.0);
|
||||
|
||||
size_t ceiledScreenWidth = static_cast<int>(pow(2.0, ceil(log(double(p.m_screenWidth + 1)) / log2)));
|
||||
size_t ceiledScreenHeight = static_cast<int>(pow(2.0, ceil(log(double(p.m_screenHeight + 1)) / log2)));
|
||||
size_t maxScreenSize = max(p.m_screenWidth, p.m_screenHeight);
|
||||
size_t ceiledScreenSize = static_cast<int>(pow(2.0, ceil(log(double(maxScreenSize + 1)) / log2)));
|
||||
size_t flooredScreenSize = ceiledScreenSize / 2;
|
||||
size_t resScreenSize = 0;
|
||||
|
||||
size_t ceiledScreenSize = max(ceiledScreenWidth, ceiledScreenHeight);
|
||||
if (ceiledScreenSize - maxScreenSize < maxScreenSize - flooredScreenSize)
|
||||
resScreenSize = ceiledScreenSize;
|
||||
else
|
||||
resScreenSize = flooredScreenSize;
|
||||
|
||||
m_TileSize = min(max(ceiledScreenSize / 2, (size_t)128), (size_t)1024);
|
||||
m_TileSize = min(max(resScreenSize / 2, (size_t)128), (size_t)1024);
|
||||
|
||||
LOG(LINFO, ("ScreenSize=", p.m_screenWidth, "x", p.m_screenHeight, ", TileSize=", m_TileSize));
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ bool BenchmarkEngine::NextBenchmarkCommand()
|
|||
int fenceID = m_framework->GetRenderPolicy()->InsertBenchmarkFence();
|
||||
|
||||
m_framework->ShowRect(m_benchmarks[m_curBenchmark].m_provider->nextRect());
|
||||
m_curBenchmarkRect = m_framework->m_navigator.Screen().GlobalRect().GetGlobalRect();
|
||||
m_curBenchmarkRect = m_framework->GetCurrentViewport();
|
||||
|
||||
m_framework->GetRenderPolicy()->JoinBenchmarkFence(fenceID);
|
||||
|
||||
|
|
|
@ -219,6 +219,7 @@ Framework::Framework()
|
|||
|
||||
Framework::~Framework()
|
||||
{
|
||||
delete m_benchmarkEngine;
|
||||
ClearBookmarks();
|
||||
}
|
||||
|
||||
|
@ -1132,6 +1133,11 @@ bool Framework::SetViewportByURL(string const & url)
|
|||
return false;
|
||||
}
|
||||
|
||||
m2::RectD Framework::GetCurrentViewport() const
|
||||
{
|
||||
return m_navigator.Screen().ClipRect();
|
||||
}
|
||||
|
||||
bool Framework::IsBenchmarking() const
|
||||
{
|
||||
return m_benchmarkEngine != 0;
|
||||
|
|
|
@ -197,12 +197,14 @@ public:
|
|||
bool isTiling);
|
||||
|
||||
private:
|
||||
inline m2::RectD GetCurrentViewport() const { return m_navigator.Screen().ClipRect(); }
|
||||
|
||||
search::Engine * GetSearchEngine() const;
|
||||
|
||||
void CheckMinGlobalRect(m2::RectD & r) const;
|
||||
|
||||
public:
|
||||
m2::RectD GetCurrentViewport() const;
|
||||
|
||||
/// Call this function before entering search GUI.
|
||||
/// While it's loading, we can cache features near user's position.
|
||||
/// @param[in] hasPt Are (lat, lon) valid
|
||||
|
|
|
@ -629,5 +629,6 @@ void RenderQueueRoutine::joinBenchmarkFence(int id)
|
|||
|
||||
void RenderQueueRoutine::signalBenchmarkFence()
|
||||
{
|
||||
m_fenceManager.signalFence(m_currentFenceID);
|
||||
if (m_currentFenceID != -1)
|
||||
m_fenceManager.signalFence(m_currentFenceID);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue