remove useless lock calls

This commit is contained in:
Maximilian Seidler 2025-11-27 17:09:00 +01:00
parent e31633d60f
commit d981fe6a7c

View file

@ -37,28 +37,22 @@ void CBaseAnimatedVariable::disconnectFromActive() {
}
bool Hyprutils::Animation::CBaseAnimatedVariable::enabled() const {
if (const auto PCONFIG = m_pConfig.lock()) {
const auto PVALUES = PCONFIG->pValues.lock();
return PVALUES ? PVALUES->internalEnabled : false;
}
if (m_pConfig && m_pConfig->pValues)
return m_pConfig->pValues->internalEnabled;
return false;
}
const std::string& CBaseAnimatedVariable::getBezierName() const {
if (const auto PCONFIG = m_pConfig.lock()) {
const auto PVALUES = PCONFIG->pValues.lock();
return PVALUES ? PVALUES->internalBezier : DEFAULTBEZIERNAME;
}
if (m_pConfig && m_pConfig->pValues)
return m_pConfig->pValues->internalBezier;
return DEFAULTBEZIERNAME;
}
const std::string& CBaseAnimatedVariable::getStyle() const {
if (const auto PCONFIG = m_pConfig.lock()) {
const auto PVALUES = PCONFIG->pValues.lock();
return PVALUES ? PVALUES->internalStyle : DEFAULTSTYLE;
}
if (m_pConfig && m_pConfig->pValues)
return m_pConfig->pValues->internalStyle;
return DEFAULTSTYLE;
}
@ -66,10 +60,8 @@ const std::string& CBaseAnimatedVariable::getStyle() const {
float CBaseAnimatedVariable::getPercent() const {
const auto DURATIONPASSED = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - animationBegin).count();
if (const auto PCONFIG = m_pConfig.lock()) {
const auto PVALUES = PCONFIG->pValues.lock();
return PVALUES ? std::clamp((DURATIONPASSED / 100.f) / PVALUES->internalSpeed, 0.f, 1.f) : 1.f;
}
if (m_pConfig && m_pConfig->pValues)
return std::clamp((DURATIONPASSED / 100.f) / m_pConfig->pValues->internalSpeed, 0.f, 1.f);
return 1.f;
}
@ -78,14 +70,7 @@ float CBaseAnimatedVariable::getCurveValue() const {
if (!m_bIsBeingAnimated || isAnimationManagerDead())
return 1.f;
std::string bezierName = "";
if (const auto PCONFIG = m_pConfig.lock()) {
const auto PVALUES = PCONFIG->pValues.lock();
if (PVALUES)
bezierName = PVALUES->internalBezier;
}
const auto BEZIER = m_pAnimationManager->getBezier(bezierName);
const auto BEZIER = m_pAnimationManager->getBezier(getBezierName());
if (!BEZIER)
return 1.f;