mirror of
https://github.com/hyprwm/hyprutils.git
synced 2025-12-20 08:10:10 +01:00
remove useless lock calls
This commit is contained in:
parent
e31633d60f
commit
d981fe6a7c
1 changed files with 9 additions and 24 deletions
|
|
@ -37,28 +37,22 @@ void CBaseAnimatedVariable::disconnectFromActive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Hyprutils::Animation::CBaseAnimatedVariable::enabled() const {
|
bool Hyprutils::Animation::CBaseAnimatedVariable::enabled() const {
|
||||||
if (const auto PCONFIG = m_pConfig.lock()) {
|
if (m_pConfig && m_pConfig->pValues)
|
||||||
const auto PVALUES = PCONFIG->pValues.lock();
|
return m_pConfig->pValues->internalEnabled;
|
||||||
return PVALUES ? PVALUES->internalEnabled : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CBaseAnimatedVariable::getBezierName() const {
|
const std::string& CBaseAnimatedVariable::getBezierName() const {
|
||||||
if (const auto PCONFIG = m_pConfig.lock()) {
|
if (m_pConfig && m_pConfig->pValues)
|
||||||
const auto PVALUES = PCONFIG->pValues.lock();
|
return m_pConfig->pValues->internalBezier;
|
||||||
return PVALUES ? PVALUES->internalBezier : DEFAULTBEZIERNAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DEFAULTBEZIERNAME;
|
return DEFAULTBEZIERNAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CBaseAnimatedVariable::getStyle() const {
|
const std::string& CBaseAnimatedVariable::getStyle() const {
|
||||||
if (const auto PCONFIG = m_pConfig.lock()) {
|
if (m_pConfig && m_pConfig->pValues)
|
||||||
const auto PVALUES = PCONFIG->pValues.lock();
|
return m_pConfig->pValues->internalStyle;
|
||||||
return PVALUES ? PVALUES->internalStyle : DEFAULTSTYLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DEFAULTSTYLE;
|
return DEFAULTSTYLE;
|
||||||
}
|
}
|
||||||
|
|
@ -66,10 +60,8 @@ const std::string& CBaseAnimatedVariable::getStyle() const {
|
||||||
float CBaseAnimatedVariable::getPercent() const {
|
float CBaseAnimatedVariable::getPercent() const {
|
||||||
const auto DURATIONPASSED = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - animationBegin).count();
|
const auto DURATIONPASSED = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - animationBegin).count();
|
||||||
|
|
||||||
if (const auto PCONFIG = m_pConfig.lock()) {
|
if (m_pConfig && m_pConfig->pValues)
|
||||||
const auto PVALUES = PCONFIG->pValues.lock();
|
return std::clamp((DURATIONPASSED / 100.f) / m_pConfig->pValues->internalSpeed, 0.f, 1.f);
|
||||||
return PVALUES ? std::clamp((DURATIONPASSED / 100.f) / PVALUES->internalSpeed, 0.f, 1.f) : 1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1.f;
|
return 1.f;
|
||||||
}
|
}
|
||||||
|
|
@ -78,14 +70,7 @@ float CBaseAnimatedVariable::getCurveValue() const {
|
||||||
if (!m_bIsBeingAnimated || isAnimationManagerDead())
|
if (!m_bIsBeingAnimated || isAnimationManagerDead())
|
||||||
return 1.f;
|
return 1.f;
|
||||||
|
|
||||||
std::string bezierName = "";
|
const auto BEZIER = m_pAnimationManager->getBezier(getBezierName());
|
||||||
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);
|
|
||||||
if (!BEZIER)
|
if (!BEZIER)
|
||||||
return 1.f;
|
return 1.f;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue