From c0c5621b53d0198f5abb07c6ddb7b506662666f5 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Mon, 16 Jul 2018 15:53:54 +0900 Subject: [PATCH] lottie/optimization: update the layer item only when it has change. Change-Id: If62c796f18ebea949fe598f0f5890f09bd8a42b8 --- src/lottie/lottieitem.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 62e46c6..cd30aa8 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -448,24 +448,18 @@ void LOTLayerItem::update(int frameNo, const VMatrix &parentMatrix, float parent } // 3. update the dirty flag based on the change - if (flag() & DirtyFlagBit::All) { - mCombinedMatrix = m; - mCombinedAlpha = alpha; - } else { - if (!mCombinedMatrix.fuzzyCompare(m)) { - mDirtyFlag |= DirtyFlagBit::Matrix; - mCombinedMatrix = m; - } - if (!vCompare(mCombinedAlpha, alpha)) { - mDirtyFlag |= DirtyFlagBit::Alpha; - mCombinedAlpha = alpha; - } + if (!mCombinedMatrix.fuzzyCompare(m)) { + mDirtyFlag |= DirtyFlagBit::Matrix; + } + if (!vCompare(mCombinedAlpha, alpha)) { + mDirtyFlag |= DirtyFlagBit::Alpha; } + mCombinedMatrix = m; + mCombinedAlpha = alpha; // 4. if no parent property change and layer is static then nothing to do. - //@TODO fix this regression -// if ((flag() & DirtyFlagBit::None) && isStatic()) -// return; + if ((flag() & DirtyFlagBit::None) && isStatic()) + return; //5. update the content of the layer updateContent(); -- 2.34.1