From: subhransu mohanty Date: Thu, 16 Aug 2018 04:37:21 +0000 (+0900) Subject: lottie/optimization: keep drawablelist in layer to avoid memory allocation in every... X-Git-Tag: submit/tizen/20180917.042405~109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da553c4dab597dd44ab9d071d735211ce9c40838;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie/optimization: keep drawablelist in layer to avoid memory allocation in every frame. Change-Id: I80eebb9e1ab16a424a26a17ce67274c7518efca9 --- diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 25056cf..5896543 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -160,14 +160,14 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLayerIt { VRle matteRle; if (matteSource) { - std::vector matteList; - matteSource->renderList(matteList); - for (auto &i : matteList) { + mDrawableList.clear(); + matteSource->renderList(mDrawableList); + for (auto &i : mDrawableList) { matteRle = matteRle + i->rle(); } } - std::vector list; - renderList(list); + mDrawableList.clear(); + renderList(mDrawableList); VRle mask = inheritMask; if (hasMask()) { if (mask.isEmpty()) @@ -176,7 +176,7 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLayerIt mask = mask & inheritMask; } - for (auto &i : list) { + for (auto &i : mDrawableList) { painter->setBrush(i->mBrush); VRle rle = i->rle(); if (!mask.isEmpty()) rle = i->rle() & mask; @@ -343,9 +343,9 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLay { VRle matteRle; if (matteSource) { - std::vector matteList; - matteSource->renderList(matteList); - for (auto &i : matteList) { + mDrawableList.clear(); + matteSource->renderList(mDrawableList); + for (auto &i : mDrawableList) { matteRle = matteRle + i->rle(); } } diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index 6c769e0..c3d5066 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -79,6 +79,7 @@ protected: VRle maskRle(const VRect &clipRect); bool hasMask() const {return !mMasks.empty();} protected: + std::vector mDrawableList; std::vector> mMasks; LOTLayerData *mLayerData; LOTLayerItem *mParentLayer;