From: subhransu mohanty Date: Thu, 6 Sep 2018 03:16:59 +0000 (+0900) Subject: lottie: keep the content in back-tofron order in lottie scenegraph. X-Git-Tag: submit/tizen/20180917.042405~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=acfadf70a4f93655ab64c440f7813cf777b3d7dd;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie: keep the content in back-tofron order in lottie scenegraph. Change-Id: I15090782105c5e30d38e4d2df896d430d6f8cc19 --- diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 6c1b1f5..56a4532 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -556,6 +556,9 @@ void LOTContentGroupItem::addChildren(LOTGroupData *data) mContents.push_back(std::move(content)); } } + + // keep the content in back-to-front order. + std::reverse(mContents.begin(), mContents.end()); } void LOTContentGroupItem::update(int frameNo, const VMatrix &parentMatrix, @@ -582,17 +585,18 @@ void LOTContentGroupItem::update(int frameNo, const VMatrix &parentMatrix, mMatrix = m; - for (auto i = mContents.rbegin(); i != mContents.rend(); ++i) { - (*i)->update(frameNo, m, alpha, newFlag); + for (const auto &content : mContents) { + content->update(frameNo, m, alpha, newFlag); } } void LOTContentGroupItem::applyTrim() { - for (auto &i : mContents) { - if (auto trim = dynamic_cast(i.get())) { + for (auto i = mContents.rbegin(); i != mContents.rend(); ++i) { + auto content = (*i).get(); + if (auto trim = dynamic_cast(content)) { trim->update(); - } else if (auto group = dynamic_cast(i.get())) { + } else if (auto group = dynamic_cast(content)) { group->applyTrim(); } } @@ -600,8 +604,8 @@ void LOTContentGroupItem::applyTrim() void LOTContentGroupItem::renderList(std::vector &list) { - for (auto i = mContents.rbegin(); i != mContents.rend(); ++i) { - (*i)->renderList(list); + for (const auto &content : mContents) { + content->renderList(list); } } @@ -609,15 +613,16 @@ void LOTContentGroupItem::processPaintItems( std::vector &list) { int curOpCount = list.size(); - for (auto &i : mContents) { - if (auto pathNode = dynamic_cast(i.get())) { + for (auto i = mContents.rbegin(); i != mContents.rend(); ++i) { + auto content = (*i).get(); + if (auto pathNode = dynamic_cast(content)) { // add it to the list list.push_back(pathNode); - } else if (auto paintNode = dynamic_cast(i.get())) { + } else if (auto paintNode = dynamic_cast(content)) { // the node is a paint data node update the path list of the paint item. paintNode->addPathItems(list, curOpCount); } else if (auto groupNode = - dynamic_cast(i.get())) { + dynamic_cast(content)) { // update the groups node with current list groupNode->processPaintItems(list); } @@ -628,15 +633,16 @@ void LOTContentGroupItem::processTrimItems( std::vector &list) { int curOpCount = list.size(); - for (auto &i : mContents) { - if (auto pathNode = dynamic_cast(i.get())) { + for (auto i = mContents.rbegin(); i != mContents.rend(); ++i) { + auto content = (*i).get(); + if (auto pathNode = dynamic_cast(content)) { // add it to the list list.push_back(pathNode); - } else if (auto trimNode = dynamic_cast(i.get())) { + } else if (auto trimNode = dynamic_cast(content)) { // the node is a paint data node update the path list of the paint item. trimNode->addPathItems(list, curOpCount); } else if (auto groupNode = - dynamic_cast(i.get())) { + dynamic_cast(content)) { // update the groups node with current list groupNode->processTrimItems(list); }