From 471c32e22c68833d3b2e7fb9e3f6a993395dc87b Mon Sep 17 00:00:00 2001 From: Jiyun Yang Date: Wed, 30 Aug 2023 21:29:01 +0900 Subject: [PATCH] Do not skip update when it has dynamic property In following cases, ```c++ animation->setValue("**", red); animation->render(0, surface); // after render is finished animation->setValue("**", blue); animation->render(0, surface); ``` Or ```c++ animation->setValue("**", [&](const FrameInfo& info) { return colors->getColor(); }); colors->setColor(red); animation->render(0, surface); // after render is finished colors->setColor(blue); animation->render(0, surface); ``` the second render request for both cases should not be ignored even if it's the same request as previous. Change-Id: I0337e885e7d7623c01332415207829da8549ddce Signed-off-by: Jiyun Yang --- src/lottie/lottieitem.cpp | 3 ++- src/lottie/lottieitem.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index f5c8c2f..7c7694e 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -109,6 +109,7 @@ renderer::Composition::Composition(std::shared_ptr model) void renderer::Composition::setValue(const std::string &keypath, LOTVariant & value) { + mHasDynamicValue = true; LOTKeyPath key(keypath); mRootLayer->resolveKeyPath(key, 0, value); } @@ -117,7 +118,7 @@ bool renderer::Composition::update(int frameNo, const VSize &size, bool keepAspectRatio) { // check if cached frame is same as requested frame. - if ((mViewSize == size) && (mCurFrameNo == frameNo) && + if (!mHasDynamicValue && (mViewSize == size) && (mCurFrameNo == frameNo) && (mKeepAspectRatio == keepAspectRatio)) return false; diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index b070897..d3ffb7a 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -207,6 +207,7 @@ private: VArenaAlloc mAllocator{2048}; int mCurFrameNo; bool mKeepAspectRatio{true}; + bool mHasDynamicValue{false}; }; class Layer { -- 2.34.1