mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-27 02:49:48 +01:00
animationmgr: Optimize CAnimationManager::scheduleTick a bit. (#3172)
* Optimize CAnimationManager::scheduleTick a bit. * Use integer in wl_event_source_timer_update call.
This commit is contained in:
parent
db48f973fd
commit
28f1f035b1
1 changed files with 4 additions and 5 deletions
|
@ -539,15 +539,14 @@ void CAnimationManager::scheduleTick() {
|
|||
|
||||
const auto PMOSTHZ = g_pHyprRenderer->m_pMostHzMonitor;
|
||||
|
||||
float refreshRate = PMOSTHZ ? PMOSTHZ->refreshRate : 60.f;
|
||||
float refreshDelayMs = std::floor(1000.0 / refreshRate);
|
||||
|
||||
if (!PMOSTHZ) {
|
||||
wl_event_source_timer_update(m_pAnimationTick, refreshDelayMs);
|
||||
wl_event_source_timer_update(m_pAnimationTick, 16);
|
||||
return;
|
||||
}
|
||||
|
||||
const float SINCEPRES = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - PMOSTHZ->lastPresentationTimer.chrono()).count() / 1000.0;
|
||||
float refreshDelayMs = std::floor(1000.f / PMOSTHZ->refreshRate);
|
||||
|
||||
const float SINCEPRES = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - PMOSTHZ->lastPresentationTimer.chrono()).count() / 1000.f;
|
||||
|
||||
const auto TOPRES = std::clamp(refreshDelayMs - SINCEPRES, 1.1f, 1000.f); // we can't send 0, that will disarm it
|
||||
|
||||
|
|
Loading…
Reference in a new issue