From: subhransu mohanty Date: Mon, 16 Jul 2018 06:48:03 +0000 (+0900) Subject: lottie: fix issue of layer static property updation. X-Git-Tag: submit/tizen/20180917.042405~249 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F85%2F184185%2F2;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie: fix issue of layer static property updation. Layer can have a parent as well as can be part of the precomp layer. so take both layers static property into consideration while updating the static property. Change-Id: I59db01a596977896ab1e9c131ee3ff28e694ff0b --- diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 6b4b2a7..62e46c6 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -410,6 +410,7 @@ VRle LOTLayerItem::maskRle() LOTLayerItem::LOTLayerItem(LOTLayerData *layerData):mLayerData(layerData), mParentLayer(nullptr), + mPrecompLayer(nullptr), mFrameNo(-1), mDirtyFlag(DirtyFlagBit::All) { @@ -425,7 +426,9 @@ void LOTLayerItem::updateStaticProperty() if (mParentLayer) mParentLayer->updateStaticProperty(); - mStatic = mParentLayer ? (mLayerData->isStatic() & mParentLayer->isStatic()) : mLayerData->isStatic(); + mStatic = mLayerData->isStatic(); + mStatic = mParentLayer ? (mStatic & mParentLayer->isStatic()) : mStatic; + mStatic = mPrecompLayer ? (mStatic & mPrecompLayer->isStatic()) : mStatic; } void LOTLayerItem::update(int frameNo, const VMatrix &parentMatrix, float parentAlpha) @@ -519,10 +522,17 @@ LOTCompLayerItem::LOTCompLayerItem(LOTLayerData *layerModel):LOTLayerItem(layerM i->setParentLayer(parentLayer); } } + i->setPrecompLayer(this); } - for(auto i : mLayers) { +} + +void LOTCompLayerItem::updateStaticProperty() +{ + LOTLayerItem::updateStaticProperty(); + + for(auto i : mLayers) { i->updateStaticProperty(); - } + } } LOTCompLayerItem::~LOTCompLayerItem() diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index d6e9261..6fd6f32 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -59,10 +59,11 @@ public: int id() const {return mLayerData->id();} int parentId() const {return mLayerData->parentId();} void setParentLayer(LOTLayerItem *parent){mParentLayer = parent;} + void setPrecompLayer(LOTLayerItem *precomp){mPrecompLayer = precomp;} virtual void update(int frameNo, const VMatrix &parentMatrix, float parentAlpha); VMatrix matrix(int frameNo) const; virtual void renderList(std::vector &list){} - void updateStaticProperty(); + virtual void updateStaticProperty(); void render(VPainter *painter); protected: virtual void updateContent() = 0; @@ -79,6 +80,7 @@ protected: std::vector> mMasks; LOTLayerData *mLayerData; LOTLayerItem *mParentLayer; + LOTLayerItem *mPrecompLayer; VMatrix mCombinedMatrix; float mCombinedAlpha; int mFrameNo; @@ -93,6 +95,7 @@ public: ~LOTCompLayerItem(); LOTCompLayerItem(LOTLayerData *layerData); void renderList(std::vector &list)final; + void updateStaticProperty() final; protected: void updateContent() final; private: