Changeset View
Changeset View
Standalone View
Standalone View
files/implement-missing-null-layer.patch
- This file was added.
| --- a/src/bodymovin/CMakeLists.txt | |||||
| +++ b/src/bodymovin/CMakeLists.txt | |||||
| @@ -15,6 +15,7 @@ qt_internal_add_module(BodymovinPrivate | |||||
| bmimage.cpp bmimage_p.h | |||||
| bmimagelayer.cpp bmimagelayer_p.h | |||||
| bmlayer.cpp bmlayer_p.h | |||||
| + bmnulllayer.cpp bmnulllayer_p.h | |||||
| bmpathtrimmer.cpp bmpathtrimmer_p.h | |||||
| bmproperty_p.h | |||||
| bmrect.cpp bmrect_p.h | |||||
| --- a/src/bodymovin/bmlayer.cpp | |||||
| +++ b/src/bodymovin/bmlayer.cpp | |||||
| @@ -35,6 +35,7 @@ | |||||
| #include <QLoggingCategory> | |||||
| #include "bmimagelayer_p.h" | |||||
| +#include "bmnulllayer_p.h" | |||||
| #include "bmshapelayer_p.h" | |||||
| #include "bmfilleffect_p.h" | |||||
| #include "bmbasictransform_p.h" | |||||
| @@ -84,6 +85,10 @@ BMLayer *BMLayer::construct(QJsonObject | |||||
| qCDebug(lcLottieQtBodymovinParser) << "Parse image layer"; | |||||
| layer = new BMImageLayer(definition); | |||||
| break; | |||||
| + case 3: | |||||
| + qCDebug(lcLottieQtBodymovinParser) << "Parse null layer"; | |||||
| + layer = new BMNullLayer(definition); | |||||
| + break; | |||||
| case 4: | |||||
| qCDebug(lcLottieQtBodymovinParser) << "Parse shape layer"; | |||||
| layer = new BMShapeLayer(definition); | |||||
| --- /dev/null | |||||
| +++ b/src/bodymovin/bmnulllayer.cpp | |||||
| @@ -0,0 +1,116 @@ | |||||
| +/**************************************************************************** | |||||
| +** | |||||
| +** Copyright (C) 2021 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$ | |||||
| +** | |||||
| +****************************************************************************/ | |||||
| + | |||||
| +#include "bmnulllayer_p.h" | |||||
| + | |||||
| +#include <QJsonObject> | |||||
| +#include <QJsonArray> | |||||
| + | |||||
| + | |||||
| +#include "bmconstants_p.h" | |||||
| +#include "bmbase_p.h" | |||||
| +#include "bmbasictransform_p.h" | |||||
| +#include "lottierenderer_p.h" | |||||
| + | |||||
| +QT_BEGIN_NAMESPACE | |||||
| + | |||||
| +BMNullLayer::BMNullLayer(const BMNullLayer &other) | |||||
| + : BMLayer(other) | |||||
| +{ | |||||
| + m_layerTransform = new BMBasicTransform(*other.m_layerTransform); | |||||
| + m_layerTransform->setParent(this); | |||||
| +} | |||||
| + | |||||
| +BMNullLayer::BMNullLayer(const QJsonObject &definition) | |||||
| +{ | |||||
| + m_type = BM_LAYER_NULL_IX; | |||||
| + | |||||
| + BMLayer::parse(definition); | |||||
| + if (m_hidden) | |||||
| + return; | |||||
| + | |||||
| + qCDebug(lcLottieQtBodymovinParser) << "BMNullLayer::BMNullLayer()" | |||||
| + << m_name; | |||||
| + | |||||
| + QJsonObject trans = definition.value(QLatin1String("ks")).toObject(); | |||||
| + m_layerTransform = new BMBasicTransform(trans, this); | |||||
| + | |||||
| + QJsonArray items = definition.value(QLatin1String("shapes")).toArray(); | |||||
| + QJsonArray::const_iterator itemIt = items.constEnd(); | |||||
| + while (itemIt != items.constBegin()) { | |||||
| + itemIt--; | |||||
| + BMShape *shape = BMShape::construct((*itemIt).toObject(), this); | |||||
| + if (shape) | |||||
| + appendChild(shape); | |||||
| + } | |||||
| +} | |||||
| + | |||||
| +BMNullLayer::~BMNullLayer() | |||||
| +{ | |||||
| + if (m_layerTransform) | |||||
| + delete m_layerTransform; | |||||
| +} | |||||
| + | |||||
| +BMBase *BMNullLayer::clone() const | |||||
| +{ | |||||
| + return new BMNullLayer(*this); | |||||
| +} | |||||
| + | |||||
| +void BMNullLayer::updateProperties(int frame) | |||||
| +{ | |||||
| + BMLayer::updateProperties(frame); | |||||
| + | |||||
| + m_layerTransform->updateProperties(frame); | |||||
| +} | |||||
| + | |||||
| +void BMNullLayer::render(LottieRenderer &renderer) const | |||||
| +{ | |||||
| + renderer.saveState(); | |||||
| + | |||||
| + renderEffects(renderer); | |||||
| + | |||||
| + // In case there is a linked layer, apply its transform first | |||||
| + // as it affects tranforms of this layer too | |||||
| + if (BMLayer *ll = linkedLayer()) | |||||
| + renderer.render(*ll->transform()); | |||||
| + | |||||
| + renderer.render(*this); | |||||
| + | |||||
| + m_layerTransform->render(renderer); | |||||
| + | |||||
| + for (BMBase *child : children()) { | |||||
| + if (child->hidden()) | |||||
| + continue; | |||||
| + child->render(renderer); | |||||
| + } | |||||
| + | |||||
| + renderer.restoreState(); | |||||
| +} | |||||
| + | |||||
| +QT_END_NAMESPACE | |||||
| --- /dev/null | |||||
| +++ b/src/bodymovin/bmnulllayer_p.h | |||||
| @@ -0,0 +1,69 @@ | |||||
| +/**************************************************************************** | |||||
| +** | |||||
| +** Copyright (C) 2021 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 BMNULLLAYER_P_H | |||||
| +#define BMNULLLAYER_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/bmlayer_p.h> | |||||
| + | |||||
| +QT_BEGIN_NAMESPACE | |||||
| + | |||||
| +class QJsonObject; | |||||
| + | |||||
| +class LottieRenderer; | |||||
| +class BMBasicTransform; | |||||
| + | |||||
| +class BODYMOVIN_EXPORT BMNullLayer : public BMLayer | |||||
| +{ | |||||
| +public: | |||||
| + BMNullLayer() = default; | |||||
| + explicit BMNullLayer(const BMNullLayer &other); | |||||
| + BMNullLayer(const QJsonObject &definition); | |||||
| + ~BMNullLayer() override; | |||||
| + | |||||
| + BMBase *clone() const override; | |||||
| + | |||||
| + void updateProperties(int frame) override; | |||||
| + void render(LottieRenderer &render) const override; | |||||
| +}; | |||||
| + | |||||
| +QT_END_NAMESPACE | |||||
| + | |||||
| +#endif // BMNULLLAYER_P_H | |||||
Copyright © 2015-2021 Solus Project. The Solus logo is Copyright © 2016-2021 Solus Project. All Rights Reserved.