mirror of https://github.com/procxx/kepka.git
parent
0710dde4d5
commit
9c909c8992
|
@ -22,6 +22,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Lottie {
|
namespace Lottie {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
const auto kIdealSize = QSize(512, 512);
|
||||||
|
|
||||||
std::string UnpackGzip(const QByteArray &bytes) {
|
std::string UnpackGzip(const QByteArray &bytes) {
|
||||||
const auto original = [&] {
|
const auto original = [&] {
|
||||||
return std::string(bytes.constData(), bytes.size());
|
return std::string(bytes.constData(), bytes.size());
|
||||||
|
@ -87,7 +89,7 @@ details::InitData Init(
|
||||||
return animation
|
return animation
|
||||||
? CheckSharedState(std::make_unique<SharedState>(
|
? CheckSharedState(std::make_unique<SharedState>(
|
||||||
std::move(animation),
|
std::move(animation),
|
||||||
request,
|
request.empty() ? FrameRequest{ kIdealSize } : request,
|
||||||
quality))
|
quality))
|
||||||
: Error::ParseFailed;
|
: Error::ParseFailed;
|
||||||
}
|
}
|
||||||
|
@ -98,6 +100,8 @@ details::InitData Init(
|
||||||
const QByteArray &cached,
|
const QByteArray &cached,
|
||||||
const FrameRequest &request,
|
const FrameRequest &request,
|
||||||
Quality quality) {
|
Quality quality) {
|
||||||
|
Expects(!request.empty());
|
||||||
|
|
||||||
if (const auto error = ContentError(content)) {
|
if (const auto error = ContentError(content)) {
|
||||||
return *error;
|
return *error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,7 +438,7 @@ bool Cache::readHeader(const FrameRequest &request) {
|
||||||
|| (original.width() > kMaxSize)
|
|| (original.width() > kMaxSize)
|
||||||
|| (original.height() > kMaxSize)
|
|| (original.height() > kMaxSize)
|
||||||
|| (frameRate <= 0)
|
|| (frameRate <= 0)
|
||||||
|| (frameRate > kMaxFrameRate)
|
|| (frameRate > kNormalFrameRate && frameRate != kMaxFrameRate)
|
||||||
|| (framesCount <= 0)
|
|| (framesCount <= 0)
|
||||||
|| (framesCount > kMaxFramesCount)
|
|| (framesCount > kMaxFramesCount)
|
||||||
|| (framesReady <= 0)
|
|| (framesReady <= 0)
|
||||||
|
|
|
@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Lottie {
|
namespace Lottie {
|
||||||
|
|
||||||
inline constexpr auto kTimeUnknown = std::numeric_limits<crl::time>::min();
|
inline constexpr auto kTimeUnknown = std::numeric_limits<crl::time>::min();
|
||||||
inline constexpr auto kMaxFileSize = 1024 * 1024;
|
inline constexpr auto kMaxFileSize = 2 * 1024 * 1024;
|
||||||
|
|
||||||
class Animation;
|
class Animation;
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,11 @@ class Animation;
|
||||||
|
|
||||||
namespace Lottie {
|
namespace Lottie {
|
||||||
|
|
||||||
|
// Frame rate can be 1, 2, ... , 29, 30 or 60.
|
||||||
|
inline constexpr auto kNormalFrameRate = 30;
|
||||||
inline constexpr auto kMaxFrameRate = 60;
|
inline constexpr auto kMaxFrameRate = 60;
|
||||||
inline constexpr auto kMaxSize = 512;
|
inline constexpr auto kMaxSize = 4096;
|
||||||
inline constexpr auto kMaxFramesCount = 180;
|
inline constexpr auto kMaxFramesCount = 210;
|
||||||
inline constexpr auto kFrameDisplayTimeAlreadyDone
|
inline constexpr auto kFrameDisplayTimeAlreadyDone
|
||||||
= std::numeric_limits<crl::time>::max();
|
= std::numeric_limits<crl::time>::max();
|
||||||
inline constexpr auto kDisplayedInitial = crl::time(-1);
|
inline constexpr auto kDisplayedInitial = crl::time(-1);
|
||||||
|
|
Loading…
Reference in New Issue