mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-03 16:05:57 +00:00
Extract some Lottie::Animation code to Lottie::Player.
This commit is contained in:
30
Telegram/SourceFiles/lottie/lottie_common.cpp
Normal file
30
Telegram/SourceFiles/lottie/lottie_common.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
#include "lottie/lottie_common.h"
|
||||
|
||||
#include "base/algorithm.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
namespace Lottie {
|
||||
namespace {
|
||||
|
||||
QByteArray ReadFile(const QString &filepath) {
|
||||
auto f = QFile(filepath);
|
||||
return (f.size() <= kMaxFileSize && f.open(QIODevice::ReadOnly))
|
||||
? f.readAll()
|
||||
: QByteArray();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
QByteArray ReadContent(const QByteArray &data, const QString &filepath) {
|
||||
return data.isEmpty() ? ReadFile(filepath) : base::duplicate(data);
|
||||
}
|
||||
|
||||
} // namespace Lottie
|
Reference in New Issue
Block a user