From: subhransu mohanty Date: Thu, 19 Jul 2018 06:04:57 +0000 (+0900) Subject: lottie/render: start all preprocess task at once before rendering the frame. X-Git-Tag: submit/tizen/20180917.042405~220 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F96%2F184596%2F1;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie/render: start all preprocess task at once before rendering the frame. Change-Id: I6c625a3ed069c40d4f42fbb3579120ffbcc30d54 --- diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 5bae4e9..a48777b 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -271,14 +271,14 @@ bool LOTCompItem::update(int frameNo) void LOTCompItem::buildRenderList() { - mRenderList.clear(); - std::vector list; + mDrawableList.clear(); for (auto i = mLayers.rbegin(); i != mLayers.rend(); ++i) { LOTLayerItem *layer = *i; - layer->renderList(list); + layer->renderList(mDrawableList); } - for(auto i : list) { + mRenderList.clear(); + for(auto i : mDrawableList) { i->sync(); mRenderList.push_back(&i->mCNode); } @@ -294,6 +294,12 @@ bool LOTCompItem::render(const LOTBuffer &buffer) VBitmap bitmap((uchar *)buffer.buffer, buffer.width, buffer.height, buffer.bytesPerLine, VBitmap::Format::ARGB32_Premultiplied, nullptr, nullptr); + /* schedule all preprocess task for this frame at once. + */ + for (auto &e : mDrawableList) { + e->preprocess(); + } + VPainter painter(&bitmap); VRle mask; for (auto i = mLayers.rbegin(); i != mLayers.rend(); ++i) { @@ -349,11 +355,6 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask) mask = mask & inheritMask; } - // do preprocessing first to take advantage of thread pool. - for(auto i : list) { - i->preprocess(); - } - for(auto i : list) { painter->setBrush(i->mBrush); if (!mask.isEmpty()) { diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index 5054b6a..259aeeb 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -48,6 +48,7 @@ private: bool mUpdateViewBox; int mCurFrameNo; std::vector mRenderList; + std::vector mDrawableList; }; typedef vFlag DirtyFlag;