init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
This commit is contained in:
95
Telegram/lib_lottie/lottie/lottie_common.h
Normal file
95
Telegram/lib_lottie/lottie/lottie_common.h
Normal file
@@ -0,0 +1,95 @@
|
||||
// This file is part of Desktop App Toolkit,
|
||||
// a set of libraries for developing nice desktop applications.
|
||||
//
|
||||
// For license and copyright information please follow this link:
|
||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "base/basic_types.h"
|
||||
|
||||
#include <QSize>
|
||||
#include <QColor>
|
||||
#include <QImage>
|
||||
#include <crl/crl_time.h>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
namespace Lottie {
|
||||
|
||||
inline constexpr auto kTimeUnknown = std::numeric_limits<crl::time>::min();
|
||||
inline constexpr auto kMaxFileSize = 2 * 1024 * 1024;
|
||||
|
||||
constexpr auto kImageFormat = QImage::Format_ARGB32_Premultiplied;
|
||||
|
||||
class Animation;
|
||||
|
||||
struct Information {
|
||||
QSize size;
|
||||
int frameRate = 0;
|
||||
int framesCount = 0;
|
||||
};
|
||||
|
||||
enum class Error {
|
||||
ParseFailed,
|
||||
NotSupported,
|
||||
};
|
||||
|
||||
struct FrameRequest {
|
||||
QSize box;
|
||||
QColor colored = QColor(0, 0, 0, 0);
|
||||
bool mirrorHorizontal = false;
|
||||
|
||||
[[nodiscard]] bool empty() const {
|
||||
return box.isEmpty();
|
||||
}
|
||||
[[nodiscard]] QSize size(
|
||||
const QSize &original,
|
||||
int sizeRounding) const;
|
||||
|
||||
[[nodiscard]] bool operator==(const FrameRequest &other) const {
|
||||
return (box == other.box)
|
||||
&& (colored == other.colored)
|
||||
&& (mirrorHorizontal == other.mirrorHorizontal);
|
||||
}
|
||||
[[nodiscard]] bool operator!=(const FrameRequest &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
enum class Quality : char {
|
||||
Default,
|
||||
High,
|
||||
Synchronous
|
||||
};
|
||||
|
||||
enum class SkinModifier {
|
||||
None,
|
||||
Color1,
|
||||
Color2,
|
||||
Color3,
|
||||
Color4,
|
||||
Color5,
|
||||
};
|
||||
|
||||
struct ColorReplacements {
|
||||
std::vector<std::pair<std::uint32_t, std::uint32_t>> replacements;
|
||||
SkinModifier modifier = SkinModifier::None;
|
||||
uint8 tag = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] QByteArray ReadContent(
|
||||
const QByteArray &data,
|
||||
const QString &filepath);
|
||||
[[nodiscard]] std::string ReadUtf8(const QByteArray &data);
|
||||
[[nodiscard]] bool GoodStorageForFrame(const QImage &storage, QSize size);
|
||||
[[nodiscard]] QImage CreateFrameStorage(QSize size);
|
||||
|
||||
enum class FrameRenderResult {
|
||||
Ok,
|
||||
NotReady,
|
||||
BadCacheSize,
|
||||
Failed,
|
||||
};
|
||||
|
||||
} // namespace Lottie
|
||||
Reference in New Issue
Block a user