mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-13 09:50:17 +00:00
lottie: fixed inefficiency using clang-tidy performance option.
Change-Id: I7fc33842e177091a596f980b87759a1cb90ed79e
This commit is contained in:
parent
234a92d533
commit
8288c8cf83
@ -35,7 +35,7 @@ std::shared_ptr<LOTModel> LottieFileCache::find(std::string &key)
|
|||||||
|
|
||||||
void LottieFileCache::add(std::string &key, std::shared_ptr<LOTModel> value)
|
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)
|
bool LottieLoader::load(std::string &path)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public:
|
|||||||
void visit(LOTPolystarData *) override {}
|
void visit(LOTPolystarData *) override {}
|
||||||
void visitChildren(LOTGroupData *obj) override
|
void visitChildren(LOTGroupData *obj) override
|
||||||
{
|
{
|
||||||
for (auto child : obj->mChildren) {
|
for (const auto& child : obj->mChildren) {
|
||||||
child.get()->accept(this);
|
child.get()->accept(this);
|
||||||
if (mRepeaterFound) {
|
if (mRepeaterFound) {
|
||||||
LOTRepeaterData *repeater =
|
LOTRepeaterData *repeater =
|
||||||
@ -31,7 +31,7 @@ public:
|
|||||||
// copy all the child of the object till repeater and
|
// copy all the child of the object till repeater and
|
||||||
// move that in to a group and then add that group to
|
// move that in to a group and then add that group to
|
||||||
// the repeater object.
|
// the repeater object.
|
||||||
for (auto cpChild : obj->mChildren) {
|
for (const auto& cpChild : obj->mChildren) {
|
||||||
if (cpChild == child) break;
|
if (cpChild == child) break;
|
||||||
// there shouldn't be any trim object left in the child list
|
// there shouldn't be any trim object left in the child list
|
||||||
if (cpChild.get()->type() == LOTData::Type::Trim) {
|
if (cpChild.get()->type() == LOTData::Type::Trim) {
|
||||||
|
|||||||
@ -533,7 +533,7 @@ VRect LottieParserImpl::getRect()
|
|||||||
|
|
||||||
void LottieParserImpl::resolveLayerRefs()
|
void LottieParserImpl::resolveLayerRefs()
|
||||||
{
|
{
|
||||||
for (auto i : mLayersToUpdate) {
|
for (const auto& i : mLayersToUpdate) {
|
||||||
LOTLayerData *layer = i.get();
|
LOTLayerData *layer = i.get();
|
||||||
auto search = compRef->mAssets.find(layer->mPreCompRefId);
|
auto search = compRef->mAssets.find(layer->mPreCompRefId);
|
||||||
if (search != compRef->mAssets.end()) {
|
if (search != compRef->mAssets.end()) {
|
||||||
@ -801,11 +801,11 @@ std::shared_ptr<LOTData> LottieParserImpl::parseLayer()
|
|||||||
}
|
}
|
||||||
// update the static property of layer
|
// update the static property of layer
|
||||||
bool staticFlag = true;
|
bool staticFlag = true;
|
||||||
for (auto child : layer->mChildren) {
|
for (const auto& child : layer->mChildren) {
|
||||||
staticFlag &= child.get()->isStatic();
|
staticFlag &= child.get()->isStatic();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto mask : layer->mMasks) {
|
for (const auto& mask : layer->mMasks) {
|
||||||
staticFlag &= mask->isStatic();
|
staticFlag &= mask->isStatic();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -955,7 +955,7 @@ std::shared_ptr<LOTData> LottieParserImpl::parseGroupObject()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool staticFlag = true;
|
bool staticFlag = true;
|
||||||
for (auto child : group->mChildren) {
|
for (const auto& child : group->mChildren) {
|
||||||
staticFlag &= child.get()->isStatic();
|
staticFlag &= child.get()->isStatic();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1923,7 +1923,7 @@ public:
|
|||||||
}
|
}
|
||||||
void visitChildren(LOTGroupData *obj) override
|
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()) {
|
switch (obj->type()) {
|
||||||
case LOTData::Type::Layer: {
|
case LOTData::Type::Layer: {
|
||||||
LOTLayerData *layer = static_cast<LOTLayerData *>(obj);
|
LOTLayerData *layer = static_cast<LOTLayerData *>(obj);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user