Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'anim/controller.cpp')
-rw-r--r--anim/controller.cpp53
1 files changed, 45 insertions, 8 deletions
diff --git a/anim/controller.cpp b/anim/controller.cpp
index 2482a21370..94495666c2 100644
--- a/anim/controller.cpp
+++ b/anim/controller.cpp
@@ -18,11 +18,17 @@ namespace anim
{
}
- void Controller::AddTask(shared_ptr<Task> const & task)
+ void Controller::AddTaskImpl(list<shared_ptr<Task> > & l, shared_ptr<Task> const & task)
{
+ l.push_back(task);
task->SetController(this);
- m_tasks.PushBack(task);
- m_IdleFrames = m_IdleThreshold;
+ if (task->IsVisual())
+ m_IdleFrames = m_IdleThreshold;
+ }
+
+ void Controller::AddTask(shared_ptr<Task> const & task)
+ {
+ m_tasks.ProcessList(bind(&Controller::AddTaskImpl, this, _1, task));
}
void Controller::CopyAndClearTasks(TTasks & from, TTasks & to)
@@ -41,6 +47,28 @@ namespace anim
return !m_tasks.Empty();
}
+ void Controller::HasVisualTasksImpl(list<shared_ptr<Task> > &l, bool *res) const
+ {
+ *res = false;
+ for (list<shared_ptr<Task> >::const_iterator it = l.begin();
+ it != l.end();
+ ++it)
+ {
+ if ((*it)->IsVisual())
+ {
+ *res = true;
+ break;
+ }
+ }
+ }
+
+ bool Controller::HasVisualTasks()
+ {
+ bool res;
+ m_tasks.ProcessList(bind(&Controller::HasVisualTasksImpl, this, _1, &res));
+ return res;
+ }
+
void Controller::Lock()
{
++m_LockCount;
@@ -65,16 +93,25 @@ namespace anim
TTasks l;
- bool hasTasks = !m_tasksList.empty();
+ bool hasVisualTasks = false;
+ for (list<shared_ptr<Task> >::const_iterator it = m_tasksList.begin();
+ it != m_tasksList.end();
+ ++it)
+ if ((*it)->IsVisual())
+ {
+ hasVisualTasks = true;
+ break;
+ }
for (TTasks::const_iterator it = m_tasksList.begin(); it != m_tasksList.end(); ++it)
{
- m_IdleFrames = m_IdleThreshold;
-
shared_ptr<Task> const & task = *it;
task->Lock();
+ if (task->IsVisual())
+ m_IdleFrames = m_IdleThreshold;
+
if (task->IsReady())
{
task->Start();
@@ -96,13 +133,13 @@ namespace anim
task->Unlock();
}
- if (!hasTasks && m_IdleFrames > 0)
+ if (!hasVisualTasks && m_IdleFrames > 0)
m_IdleFrames -= 1;
m_tasks.ProcessList(bind(&Controller::MergeTasks, ref(l), _1));
}
- bool Controller::IsPreWarmed() const
+ bool Controller::IsVisuallyPreWarmed() const
{
return m_IdleFrames > 0;
}