From 6f2d9ddf1a36eea3e42b9b085dbefd3df965336c Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Mon, 3 Sep 2018 16:39:34 +0900 Subject: [PATCH] lottie/render: hide the layer when matte layer is hidden. in AE matte layers visibility affects the layer below. Change-Id: I0d1c6e19f78bc3d25ac6ae8a56ec5371a925e300 --- src/lottie/lottieitem.cpp | 10 ++++------ src/lottie/lottieitem.h | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 03336f2..951f64b 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -159,8 +159,6 @@ VRle LOTMaskItem::rle() void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle &inheritMatte, LOTLayerItem *matteSource) { - if (!visible()) return; - VRle matteRle; if (matteSource) { mDrawableList.clear(); @@ -350,8 +348,6 @@ void LOTCompLayerItem::updateStaticProperty() void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle &inheritMatte, LOTLayerItem *matteSource) { - if (!visible()) return; - VRle matteRle; if (matteSource) { mDrawableList.clear(); @@ -388,10 +384,12 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, const } if (matteLayer) { - matteLayer->render(painter, mask, matteRle, layer); + if (matteLayer->visible() && layer->visible()) + matteLayer->render(painter, mask, matteRle, layer); matteLayer = nullptr; } else { - layer->render(painter, mask, matteRle, nullptr); + if (layer->visible()) + layer->render(painter, mask, matteRle, nullptr); } } } diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index 1396311..99db81e 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -66,6 +66,7 @@ public: virtual void updateStaticProperty(); virtual void render(VPainter *painter, const VRle &mask, const VRle &inheritMatte, LOTLayerItem *matteSource); bool hasMatte() { if (mLayerData->mMatteType == MatteType::None) return false; return true; } + bool visible() const; protected: virtual void updateContent() = 0; @@ -74,7 +75,6 @@ protected: inline float combinedAlpha() const {return mCombinedAlpha;} inline bool isStatic() const {return mStatic;} float opacity(int frameNo) const; - bool visible() const; inline DirtyFlag flag() const {return mDirtyFlag;} VRle maskRle(const VRect &clipRect); bool hasMask() const {return !mMasks.empty();} -- 2.7.4