mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Support C++14.
This commit is contained in:
parent
7815337204
commit
589db026ec
1 changed files with 6 additions and 3 deletions
|
|
@ -804,14 +804,17 @@ LottieColor LottieParserImpl::applyReplacements(const LottieColor &color)
|
|||
return color;
|
||||
}
|
||||
const auto convert = [](float value) {
|
||||
return std::uint32_t(std::round(std::clamp(value, 0.f, 1.f) * 255.));
|
||||
return std::uint32_t(
|
||||
std::round(std::min(std::max(value, 0.f), 1.f) * 255.));
|
||||
};
|
||||
const auto part = [](std::uint32_t value, int shift) {
|
||||
return float((value >> shift) & 0xFFU) / 255.f;
|
||||
};
|
||||
};
|
||||
const auto converted =
|
||||
convert(color.b) | (convert(color.g) << 8) | (convert(color.r) << 16);
|
||||
for (const auto [key, value] : mColorReplacements) {
|
||||
for (const auto &pair : mColorReplacements) {
|
||||
const auto key = pair.first;
|
||||
const auto value = pair.second;
|
||||
if (key == converted) {
|
||||
return LottieColor(part(value, 16), part(value, 8), part(value, 0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue