From f1fb128a4c5405532a7fa9b68451c7fc9f52e84c Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Fri, 29 Nov 2019 17:10:19 +0900 Subject: [PATCH] rlottie: reenabled optimization when paint item has no content --- src/lottie/lottieitem.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 292d26c..ee0743e 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -1175,16 +1175,20 @@ void LOTPaintDataItem::updateRenderNode() void LOTPaintDataItem::renderList(std::vector &list) { - //@TODO This optimization breaks when the layer - // is used as Matte. Find out the reason for this - // regression then reenable it. - //if (!mContentToRender) return; - if (mRenderNodeUpdate) { updateRenderNode(); mRenderNodeUpdate = false; } - list.push_back(&mDrawable); + + // Q: Why we even update the final path if we don't have content + // to render ? + // Ans: We update the render nodes because we will loose the + // dirty path information at end of this frame. + // so if we return early without updating the final path. + // in the subsequent frame when we have content to render but + // we may not able to update our final path properly as we + // don't know what paths got changed in between. + if (mContentToRender) list.push_back(&mDrawable); } void LOTPaintDataItem::addPathItems(std::vector &list, -- 2.34.1