Remove QtLottie and rapidjson.

This commit is contained in:
John Preston 2019-06-26 10:29:19 +02:00
parent e43fcc0e5f
commit aa3a079853
10 changed files with 30 additions and 154 deletions

6
.gitmodules vendored
View File

@ -16,12 +16,6 @@
[submodule "Telegram/ThirdParty/xxHash"]
path = Telegram/ThirdParty/xxHash
url = https://github.com/Cyan4973/xxHash.git
[submodule "Telegram/ThirdParty/qtlottie"]
path = Telegram/ThirdParty/qtlottie
url = https://github.com/telegramdesktop/qtlottie.git
[submodule "Telegram/ThirdParty/rapidjson"]
path = Telegram/ThirdParty/rapidjson
url = https://github.com/Tencent/rapidjson.git
[submodule "Telegram/ThirdParty/rlottie"]
path = Telegram/ThirdParty/rlottie
url = https://github.com/john-preston/rlottie

View File

@ -8,14 +8,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lottie/lottie_animation.h"
#include "lottie/lottie_frame_renderer.h"
#include "rasterrenderer/rasterrenderer.h"
#include "json.h"
#include "base/algorithm.h"
#include "zlib.h"
#include "logs.h"
#include "rlottie.h"
#include <QFile>
#include <QDebug>
#include <rlottie.h>
#include <crl/crl_async.h>
#include <crl/crl_on_main.h>

View File

@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lottie/lottie_frame_renderer.h"
#include "lottie/lottie_animation.h"
#include "rasterrenderer/rasterrenderer.h"
#include "logs.h"
#include "rlottie.h"
@ -178,6 +177,7 @@ SharedState::SharedState(std::unique_ptr<rlottie::Animation> animation)
: _animation(std::move(animation)) {
Expects(_animation != nullptr);
calculateProperties();
if (isValid()) {
auto cover = QImage();
renderFrame(cover, FrameRequest::NonStrict(), 0);
@ -185,33 +185,33 @@ SharedState::SharedState(std::unique_ptr<rlottie::Animation> animation)
}
}
bool SharedState::isValid() const {
void SharedState::calculateProperties() {
auto width = size_t(0);
auto height = size_t(0);
_animation->size(width, height);
const auto frameRate = int(_animation->frameRate());
return _animation->totalFrame() > 0
&& frameRate > 0
&& frameRate <= kMaxFrameRate
&& width > 0
&& width <= kMaxSize
&& height > 0
&& height <= kMaxSize;
const auto rate = _animation->frameRate();
const auto count = _animation->totalFrame();
_size = QSize(
(width > 0 && width < kMaxSize) ? int(width) : 0,
(height > 0 && height < kMaxSize) ? int(height) : 0);
_frameRate = (rate >= 1. && rate <= kMaxFrameRate) ? int(rate) : 0;
_framesCount = (count > 0) ? int(count) : 0;
}
bool SharedState::isValid() const {
return (_framesCount > 0) && (_frameRate > 0) && !_size.isEmpty();
}
void SharedState::renderFrame(
QImage &image,
const FrameRequest &request,
int index) {
auto width = size_t(0);
auto height = size_t(0);
_animation->size(width, height);
const auto realSize = QSize(width, height);
if (realSize.isEmpty() || !_animation->totalFrame()) {
if (!isValid()) {
return;
}
const auto size = request.resize.isEmpty() ? realSize : request.resize;
const auto size = request.resize.isEmpty() ? _size : request.resize;
if (!GoodStorageForFrame(image, size)) {
image = CreateFrameStorage(size);
}
@ -228,8 +228,6 @@ void SharedState::renderFrame(
void SharedState::init(QImage cover) {
Expects(!initialized());
_frameRate = int(_animation->frameRate());
_framesCount = int(_animation->totalFrame());
_duration = crl::time(1000) * _framesCount / _frameRate;
_frames[0].original = std::move(cover);
@ -331,14 +329,10 @@ Information SharedState::information() const {
if (!isValid()) {
return {};
}
auto width = size_t(0);
auto height = size_t(0);
_animation->size(width, height);
auto result = Information();
result.frameRate = int(_animation->frameRate());
result.size = QSize(width, height);
result.framesCount = int(_animation->totalFrame());
result.frameRate = _frameRate;
result.size = _size;
result.framesCount = _framesCount;
return result;
}

View File

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lottie/lottie_common.h"
#include <QImage>
#include <QSize>
#include <crl/crl_time.h>
#include <crl/crl_object_on_queue.h>
#include <limits>
@ -20,8 +21,6 @@ namespace rlottie {
class Animation;
} // namespace rlottie
class QImage;
namespace Lottie {
class Animation;
@ -61,6 +60,7 @@ public:
~SharedState();
private:
void calculateProperties();
bool isValid() const;
void init(QImage cover);
void renderNextFrame(
@ -83,7 +83,8 @@ private:
crl::time _duration = kTimeUnknown;
int _frameIndex = 0;
int _framesCount = 0;
int _frameRate;
int _frameRate = 0;
QSize _size;
std::atomic<int> _accumulatedDelayMs = 0;
};

View File

@ -1,8 +0,0 @@
/*
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_pch.h"

View File

@ -1,21 +0,0 @@
/*
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 <vector>
#include <functional>
#include <cmath>
#include <QtMath>
#include <QDebug>
#include <QList>
#include <QPointF>
#include <QSizeF>
#include <QVector4D>
#include "json.h"
#include "beziereasing.h"

@ -1 +0,0 @@
Subproject commit eeeb4edb2a087c3f8175dafafcad330864d3efc0

@ -1 +0,0 @@
Subproject commit 01950eb7acec78818d68b762efc869bba2420d82

View File

@ -16,7 +16,6 @@
'openssl.gypi',
'qt.gypi',
'telegram_linux.gypi',
'pch.gypi',
],
'variables': {
'src_loc': '../SourceFiles',
@ -24,10 +23,7 @@
'libs_loc': '../../../Libraries',
'official_build_target%': '',
'submodules_loc': '../ThirdParty',
'lottie_loc': '<(submodules_loc)/qtlottie/src',
'rlottie_loc': '<(submodules_loc)/rlottie/inc',
'pch_source': '<(src_loc)/lottie/lottie_pch.cpp',
'pch_header': '<(src_loc)/lottie/lottie_pch.h',
},
'dependencies': [
'crl.gyp:crl',
@ -40,7 +36,6 @@
'lib_rlottie.gyp:lib_rlottie',
],
'defines': [
'BODYMOVIN_LIBRARY',
'LOT_BUILD',
],
'include_dirs': [
@ -49,95 +44,16 @@
'<(libs_loc)/range-v3/include',
'<(libs_loc)/zlib',
'<(rlottie_loc)',
'<(lottie_loc)',
'<(lottie_loc)/bodymovin',
'<(lottie_loc)/imports',
'<(submodules_loc)/GSL/include',
'<(submodules_loc)/variant/include',
'<(submodules_loc)/crl/src',
'<(submodules_loc)/rapidjson/include',
],
'sources': [
# interface for tdesktop
'<(src_loc)/lottie/lottie_animation.cpp',
'<(src_loc)/lottie/lottie_animation.h',
'<(src_loc)/lottie/lottie_common.h',
'<(src_loc)/lottie/lottie_frame_renderer.cpp',
'<(src_loc)/lottie/lottie_frame_renderer.h',
# taken from qtlottie/src/bodymovin/bodymovin.pro
'<(lottie_loc)/bodymovin/bmbase.cpp',
'<(lottie_loc)/bodymovin/bmlayer.cpp',
'<(lottie_loc)/bodymovin/bmshape.cpp',
'<(lottie_loc)/bodymovin/bmshapelayer.cpp',
'<(lottie_loc)/bodymovin/bmrect.cpp',
'<(lottie_loc)/bodymovin/bmfill.cpp',
'<(lottie_loc)/bodymovin/bmgfill.cpp',
'<(lottie_loc)/bodymovin/bmgroup.cpp',
'<(lottie_loc)/bodymovin/bmstroke.cpp',
'<(lottie_loc)/bodymovin/bmbasictransform.cpp',
'<(lottie_loc)/bodymovin/bmshapetransform.cpp',
'<(lottie_loc)/bodymovin/bmellipse.cpp',
'<(lottie_loc)/bodymovin/bmround.cpp',
'<(lottie_loc)/bodymovin/bmfreeformshape.cpp',
'<(lottie_loc)/bodymovin/bmtrimpath.cpp',
'<(lottie_loc)/bodymovin/bmpathtrimmer.cpp',
'<(lottie_loc)/bodymovin/freeformshape.cpp',
'<(lottie_loc)/bodymovin/renderer.cpp',
'<(lottie_loc)/bodymovin/trimpath.cpp',
'<(lottie_loc)/bodymovin/bmfilleffect.cpp',
'<(lottie_loc)/bodymovin/bmrepeater.cpp',
'<(lottie_loc)/bodymovin/bmrepeatertransform.cpp',
'<(lottie_loc)/bodymovin/beziereasing.cpp',
'<(lottie_loc)/bodymovin/beziereasing.h',
'<(lottie_loc)/bodymovin/bmbase.h',
'<(lottie_loc)/bodymovin/bmbasictransform.h',
'<(lottie_loc)/bodymovin/bmellipse.h',
'<(lottie_loc)/bodymovin/bmfill.h',
'<(lottie_loc)/bodymovin/bmfilleffect.h',
'<(lottie_loc)/bodymovin/bmfreeformshape.h',
'<(lottie_loc)/bodymovin/bmgfill.h',
'<(lottie_loc)/bodymovin/bmgroup.h',
'<(lottie_loc)/bodymovin/bmlayer.h',
'<(lottie_loc)/bodymovin/bmproperty.h',
'<(lottie_loc)/bodymovin/bmrect.h',
'<(lottie_loc)/bodymovin/bmrepeater.h',
'<(lottie_loc)/bodymovin/bmrepeatertransform.h',
'<(lottie_loc)/bodymovin/bmround.h',
'<(lottie_loc)/bodymovin/bmshape.h',
'<(lottie_loc)/bodymovin/bmshapelayer.h',
'<(lottie_loc)/bodymovin/bmshapetransform.h',
'<(lottie_loc)/bodymovin/bmstroke.h',
'<(lottie_loc)/bodymovin/bmtrimpath.h',
'<(lottie_loc)/bodymovin/freeformshape.h',
'<(lottie_loc)/bodymovin/trimpath.h',
'<(lottie_loc)/bodymovin/renderer.h',
'<(lottie_loc)/bodymovin/bmpathtrimmer.h',
# taken from qtlottie/src/imports/imports.pro
'<(lottie_loc)/imports/rasterrenderer/rasterrenderer.cpp',
'<(lottie_loc)/imports/rasterrenderer/rasterrenderer.h',
# added to qtlottie/src/bodymovin/bodymovin.pro
'<(lottie_loc)/bodymovin/bmasset.cpp',
'<(lottie_loc)/bodymovin/bmprecompasset.cpp',
'<(lottie_loc)/bodymovin/bmnulllayer.cpp',
'<(lottie_loc)/bodymovin/bmprecomplayer.cpp',
'<(lottie_loc)/bodymovin/bmscene.cpp',
'<(lottie_loc)/bodymovin/bmmasks.cpp',
'<(lottie_loc)/bodymovin/bmmaskshape.cpp',
'<(lottie_loc)/bodymovin/bmasset.h',
'<(lottie_loc)/bodymovin/bmprecompasset.h',
'<(lottie_loc)/bodymovin/bmnulllayer.h',
'<(lottie_loc)/bodymovin/bmprecomplayer.h',
'<(lottie_loc)/bodymovin/bmscene.h',
'<(lottie_loc)/bodymovin/bmmasks.h',
'<(lottie_loc)/bodymovin/bmmaskshape.h',
'<(lottie_loc)/bodymovin/json.h',
],
'conditions': [[ 'build_macold', {
'xcode_settings': {

View File

@ -24,7 +24,6 @@
'defines': [
'_USE_MATH_DEFINES',
'LOT_BUILD',
'RLOTTIE_WITH_STATIC_QT',
],
'include_dirs': [
'<(rlottie_loc)/inc',
@ -110,7 +109,11 @@
'<(rlottie_src)/vector/vstackallocator.h',
'<(rlottie_src)/vector/vtaskqueue.h',
],
'conditions': [[ 'build_macold', {
'conditions': [[ 'not build_win', {
'defines': [
'RLOTTIE_WITH_STATIC_QT',
]
}], [ 'build_macold', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},