2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Replaced snap util function with std::clamp.

This commit is contained in:
23rd
2021-01-23 06:29:50 +03:00
parent 4895e5e110
commit dd01ece14a
44 changed files with 193 additions and 92 deletions

View File

@@ -423,7 +423,7 @@ void RoundImageCheckbox::paint(Painter &p, int x, int y, int outerWidth) {
if (selectionLevel > 0) {
PainterHighQualityEnabler hq(p);
p.setOpacity(snap(selectionLevel, 0., 1.));
p.setOpacity(std::clamp(selectionLevel, 0., 1.));
p.setBrush(Qt::NoBrush);
auto pen = _st.selectFg->p;
pen.setWidth(_st.selectWidth);
@@ -438,7 +438,7 @@ void RoundImageCheckbox::paint(Painter &p, int x, int y, int outerWidth) {
}
float64 RoundImageCheckbox::checkedAnimationRatio() const {
return snap(_selection.value(checked() ? 1. : 0.), 0., 1.);
return std::clamp(_selection.value(checked() ? 1. : 0.), 0., 1.);
}
void RoundImageCheckbox::setChecked(bool newChecked, anim::type animated) {