Replaced float interpolation with implementation from lib_ui.

This commit is contained in:
23rd 2020-12-11 11:00:51 +03:00 committed by John Preston
parent 62fe44bde8
commit bb4be4f3dd
2 changed files with 5 additions and 8 deletions

View File

@ -292,7 +292,7 @@ void TopBar::initControls() {
const auto crossProgress = (crossFrom == crossTo)
? crossTo
: (crossFrom + float64(crossTo - crossFrom) * value);
: anim::interpolateF(crossFrom, crossTo, value);
_mute->setProgress(crossProgress);
};

View File

@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_layers.h"
#include "styles/style_media_player.h"
#include "ui/controls/send_button.h"
#include "ui/effects/animation_value.h"
#include "ui/effects/ripple_animation.h"
#include "ui/text/format_values.h"
#include "window/window_session_controller.h"
@ -61,10 +62,6 @@ enum class FilterType {
Cancel,
};
inline float64 InterpolateF(int a, int b, float64 b_ratio) {
return a + float64(b - a) * b_ratio;
}
[[nodiscard]] auto InactiveColor(const QColor &c) {
return QColor(c.red(), c.green(), c.blue(), kInactiveWaveformBarAlpha);
}
@ -786,15 +783,15 @@ void RecordLock::drawProgress(Painter &p) {
const auto &blockHeight = st::historyRecordLockIconBottomHeight;
const auto blockRectWidth = InterpolateF(
const auto blockRectWidth = anim::interpolateF(
size.width(),
st::historyRecordStopIconWidth,
lockToStopProgress);
const auto blockRectHeight = InterpolateF(
const auto blockRectHeight = anim::interpolateF(
blockHeight,
st::historyRecordStopIconWidth,
lockToStopProgress);
const auto blockRectTop = InterpolateF(
const auto blockRectTop = anim::interpolateF(
size.height() - blockHeight,
std::round((size.height() - blockRectHeight) / 2.),
lockToStopProgress);