Slight tweak to further improve performance
This commit is contained in:
		
							parent
							
								
									3df5b1cf98
								
							
						
					
					
						commit
						52fc8d3594
					
				@ -17,6 +17,8 @@ AnimationLayer::AnimationLayer(QWidget *parent)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  m_ticker = new QTimer(this);
 | 
					  m_ticker = new QTimer(this);
 | 
				
			||||||
  m_ticker->setSingleShot(true);
 | 
					  m_ticker->setSingleShot(true);
 | 
				
			||||||
 | 
					  m_ticker->setTimerType(Qt::PreciseTimer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  connect(m_ticker, &QTimer::timeout, this, &AnimationLayer::frameTicker);
 | 
					  connect(m_ticker, &QTimer::timeout, this, &AnimationLayer::frameTicker);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!thread_pool)
 | 
					  if (!thread_pool)
 | 
				
			||||||
@ -258,11 +260,8 @@ void AnimationLayer::finishPlayback()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void AnimationLayer::prepareNextTick()
 | 
					void AnimationLayer::prepareNextTick()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int duration = m_current_frame.duration;
 | 
					  int duration = qMax(m_minimum_duration, m_current_frame.duration);
 | 
				
			||||||
 | 
					 | 
				
			||||||
  duration = (m_minimum_duration > 0) ? qMax(m_minimum_duration, duration) : duration;
 | 
					 | 
				
			||||||
  duration = (m_maximum_duration > 0) ? qMin(m_maximum_duration, duration) : duration;
 | 
					  duration = (m_maximum_duration > 0) ? qMin(m_maximum_duration, duration) : duration;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  m_ticker->start(duration);
 | 
					  m_ticker->start(duration);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -348,7 +347,7 @@ void AnimationLayer::frameTicker()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if (!m_pause)
 | 
					  if (!m_pause)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    m_ticker->start(m_current_frame.duration);
 | 
					    prepareNextTick();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user