2019-05-13 21:57:59 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "base/basic_types.h"
|
|
|
|
#include "base/variant.h"
|
|
|
|
|
|
|
|
#include <QSize>
|
|
|
|
#include <QColor>
|
|
|
|
#include <crl/crl_time.h>
|
|
|
|
|
|
|
|
namespace Lottie {
|
|
|
|
|
2019-06-28 11:33:47 +00:00
|
|
|
inline constexpr auto kTimeUnknown = std::numeric_limits<crl::time>::min();
|
|
|
|
inline constexpr auto kMaxFileSize = 1024 * 1024;
|
2019-05-28 11:39:38 +00:00
|
|
|
|
2019-05-13 21:57:59 +00:00
|
|
|
class Animation;
|
|
|
|
|
|
|
|
struct Information {
|
|
|
|
int frameRate = 0;
|
|
|
|
int framesCount = 0;
|
|
|
|
QSize size;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class Error {
|
|
|
|
ParseFailed,
|
|
|
|
NotSupported,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FrameRequest {
|
2019-06-26 10:01:04 +00:00
|
|
|
QSize box;
|
2019-05-13 21:57:59 +00:00
|
|
|
std::optional<QColor> colored;
|
|
|
|
|
2019-06-26 10:01:04 +00:00
|
|
|
[[nodiscard]] bool empty() const {
|
|
|
|
return box.isEmpty();
|
2019-05-13 21:57:59 +00:00
|
|
|
}
|
2019-07-05 16:13:27 +00:00
|
|
|
[[nodiscard]] QSize size(const QSize &original) const;
|
2019-06-26 10:01:04 +00:00
|
|
|
|
|
|
|
[[nodiscard]] bool operator==(const FrameRequest &other) const {
|
|
|
|
return (box == other.box)
|
2019-05-13 21:57:59 +00:00
|
|
|
&& (colored == other.colored);
|
|
|
|
}
|
2019-06-26 10:01:04 +00:00
|
|
|
[[nodiscard]] bool operator!=(const FrameRequest &other) const {
|
2019-05-13 21:57:59 +00:00
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-06-28 11:33:47 +00:00
|
|
|
QByteArray ReadContent(const QByteArray &data, const QString &filepath);
|
|
|
|
|
2019-05-13 21:57:59 +00:00
|
|
|
} // namespace Lottie
|