lottie: fixed inefficiency using clang-tidy performance option.

Change-Id: I7fc33842e177091a596f980b87759a1cb90ed79e
This commit is contained in:
subhransu mohanty 2018-09-03 19:10:44 +09:00
parent 234a92d533
commit 8288c8cf83
3 changed files with 8 additions and 8 deletions

View File

@ -35,7 +35,7 @@ std::shared_ptr<LOTModel> LottieFileCache::find(std::string &key)
void LottieFileCache::add(std::string &key, std::shared_ptr<LOTModel> value)
{
mHash[key] = value;
mHash[key] = std::move(value);
}
bool LottieLoader::load(std::string &path)

View File

@ -19,7 +19,7 @@ public:
void visit(LOTPolystarData *) override {}
void visitChildren(LOTGroupData *obj) override
{
for (auto child : obj->mChildren) {
for (const auto& child : obj->mChildren) {
child.get()->accept(this);
if (mRepeaterFound) {
LOTRepeaterData *repeater =
@ -31,7 +31,7 @@ public:
// copy all the child of the object till repeater and
// move that in to a group and then add that group to
// the repeater object.
for (auto cpChild : obj->mChildren) {
for (const auto& cpChild : obj->mChildren) {
if (cpChild == child) break;
// there shouldn't be any trim object left in the child list
if (cpChild.get()->type() == LOTData::Type::Trim) {

View File

@ -533,7 +533,7 @@ VRect LottieParserImpl::getRect()
void LottieParserImpl::resolveLayerRefs()
{
for (auto i : mLayersToUpdate) {
for (const auto& i : mLayersToUpdate) {
LOTLayerData *layer = i.get();
auto search = compRef->mAssets.find(layer->mPreCompRefId);
if (search != compRef->mAssets.end()) {
@ -801,11 +801,11 @@ std::shared_ptr<LOTData> LottieParserImpl::parseLayer()
}
// update the static property of layer
bool staticFlag = true;
for (auto child : layer->mChildren) {
for (const auto& child : layer->mChildren) {
staticFlag &= child.get()->isStatic();
}
for (auto mask : layer->mMasks) {
for (const auto& mask : layer->mMasks) {
staticFlag &= mask->isStatic();
}
@ -955,7 +955,7 @@ std::shared_ptr<LOTData> LottieParserImpl::parseGroupObject()
}
}
bool staticFlag = true;
for (auto child : group->mChildren) {
for (const auto& child : group->mChildren) {
staticFlag &= child.get()->isStatic();
}
@ -1923,7 +1923,7 @@ public:
}
void visitChildren(LOTGroupData *obj) override
{
for (auto child : obj->mChildren) child.get()->accept(this);
for (const auto& child : obj->mChildren) child.get()->accept(this);
switch (obj->type()) {
case LOTData::Type::Layer: {
LOTLayerData *layer = static_cast<LOTLayerData *>(obj);