mirror of https://github.com/procxx/kepka.git
QtLottie: Add precomp assets parsing.
This commit is contained in:
parent
f9a32dc70f
commit
2caa3e3def
|
@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <QtBodymovin/private/bmbase_p.h>
|
#include <QtBodymovin/private/bmbase_p.h>
|
||||||
#include <QtBodymovin/private/bmlayer_p.h>
|
#include <QtBodymovin/private/bmlayer_p.h>
|
||||||
|
#include <QtBodymovin/private/bmasset_p.h>
|
||||||
|
|
||||||
#include "rasterrenderer/lottierasterrenderer.h"
|
#include "rasterrenderer/lottierasterrenderer.h"
|
||||||
|
|
||||||
|
@ -138,8 +139,14 @@ void Animation::parse(const QByteArray &content) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.value(qstr("assets")).toArray().count()) {
|
const auto assets = root.value(qstr("assets")).toArray();
|
||||||
_unsupported = true;
|
for (const auto &entry : assets) {
|
||||||
|
if (const auto asset = BMAsset::construct(entry.toObject())) {
|
||||||
|
_assetIndexById.emplace(asset->id(), _assets.size());
|
||||||
|
_assets.emplace_back(asset);
|
||||||
|
} else {
|
||||||
|
_unsupported = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.value(qstr("chars")).toArray().count()) {
|
if (root.value(qstr("chars")).toArray().count()) {
|
||||||
|
|
|
@ -11,12 +11,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/flat_map.h"
|
#include "base/flat_map.h"
|
||||||
|
|
||||||
#include <crl/crl_time.h>
|
#include <crl/crl_time.h>
|
||||||
#include <QString>
|
|
||||||
#include <QHash>
|
class QImage;
|
||||||
#include <QPainter>
|
class QString;
|
||||||
|
class QByteArray;
|
||||||
|
|
||||||
class BMBase;
|
class BMBase;
|
||||||
class BMLayer;
|
class BMAsset;
|
||||||
|
|
||||||
namespace Lottie {
|
namespace Lottie {
|
||||||
|
|
||||||
|
@ -77,6 +78,8 @@ private:
|
||||||
PlaybackOptions _options;
|
PlaybackOptions _options;
|
||||||
|
|
||||||
std::unique_ptr<BMBase> _treeBlueprint;
|
std::unique_ptr<BMBase> _treeBlueprint;
|
||||||
|
std::vector<std::unique_ptr<BMAsset>> _assets;
|
||||||
|
base::flat_map<QString, int> _assetIndexById;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 270cd6f31b9c67bdf2ff7cd961df8e5bb86e137c
|
Subproject commit 44fa230637dafe2fe01ffc6e93c3e3f5841dcc5a
|
|
@ -0,0 +1,72 @@
|
||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2018 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:GPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 or (at your option) any later version
|
||||||
|
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||||
|
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef BMASSET_P_H
|
||||||
|
#define BMASSET_P_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// W A R N I N G
|
||||||
|
// -------------
|
||||||
|
//
|
||||||
|
// This file is not part of the Qt API. It exists purely as an
|
||||||
|
// implementation detail. This header file may change from version to
|
||||||
|
// version without notice, or even be removed.
|
||||||
|
//
|
||||||
|
// We mean it.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtBodymovin/private/bmbase_p.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class LottieRenderer;
|
||||||
|
|
||||||
|
class BODYMOVIN_EXPORT BMAsset : public BMBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BMAsset() = default;
|
||||||
|
explicit BMAsset (const BMAsset &other) = default;
|
||||||
|
~BMAsset() = default;
|
||||||
|
|
||||||
|
BMBase *clone() const override;
|
||||||
|
|
||||||
|
static BMAsset *construct(QJsonObject definition);
|
||||||
|
|
||||||
|
void parse(const QJsonObject &definition) override;
|
||||||
|
|
||||||
|
QString id() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_id;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // BMASSET_P_H
|
|
@ -0,0 +1,67 @@
|
||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2018 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:GPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 or (at your option) any later version
|
||||||
|
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||||
|
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef BMPRECOMPASSET_P_H
|
||||||
|
#define BMPRECOMPASSET_P_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// W A R N I N G
|
||||||
|
// -------------
|
||||||
|
//
|
||||||
|
// This file is not part of the Qt API. It exists purely as an
|
||||||
|
// implementation detail. This header file may change from version to
|
||||||
|
// version without notice, or even be removed.
|
||||||
|
//
|
||||||
|
// We mean it.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtBodymovin/private/bmasset_p.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class LottieRenderer;
|
||||||
|
|
||||||
|
class BODYMOVIN_EXPORT BMPreCompAsset : public BMAsset
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BMPreCompAsset() = default;
|
||||||
|
explicit BMPreCompAsset (const BMPreCompAsset &other) = default;
|
||||||
|
BMPreCompAsset(const QJsonObject &definition);
|
||||||
|
~BMPreCompAsset() = default;
|
||||||
|
|
||||||
|
BMBase *clone() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void parseLayers(const QJsonArray &definition);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // BMPRECOMPASSET_P_H
|
|
@ -123,8 +123,12 @@
|
||||||
'<(lottie_loc)/imports/rasterrenderer/lottierasterrenderer.h',
|
'<(lottie_loc)/imports/rasterrenderer/lottierasterrenderer.h',
|
||||||
|
|
||||||
# added to qtlottie/src/bodymovin/bodymovin.pro
|
# 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/bmnulllayer.cpp',
|
||||||
|
|
||||||
|
'<(lottie_loc)/bodymovin/bmasset_p.h',
|
||||||
|
'<(lottie_loc)/bodymovin/bmprecompasset_p.h',
|
||||||
'<(lottie_loc)/bodymovin/bmnulllayer_p.h',
|
'<(lottie_loc)/bodymovin/bmnulllayer_p.h',
|
||||||
],
|
],
|
||||||
'conditions': [[ 'build_macold', {
|
'conditions': [[ 'build_macold', {
|
||||||
|
|
Loading…
Reference in New Issue