Codechange: Avoid making copies of intermediate layout runs. (#12796)

The vector of runs is not used after it is passed to the ParagraphLayout class, so pass with std::move to avoid an unnecessary copy.
This commit is contained in:
Peter Nelson
2024-06-17 22:58:52 +01:00
committed by GitHub
parent 731c56d116
commit b56775f576
2 changed files with 4 additions and 4 deletions

View File

@@ -104,7 +104,7 @@ private:
int partial_offset;
public:
ICUParagraphLayout(std::vector<ICURun> &runs, UChar *buff, size_t buff_length) : runs(runs), buff(buff), buff_length(buff_length)
ICUParagraphLayout(std::vector<ICURun> &&runs, UChar *buff, size_t buff_length) : runs(std::move(runs)), buff(buff), buff_length(buff_length)
{
this->Reflow();
}
@@ -374,7 +374,7 @@ std::vector<ICURun> ItemizeStyle(std::vector<ICURun> &runs_current, FontMap &fon
run.Shape(buff, length);
}
return new ICUParagraphLayout(runs, buff, length);
return new ICUParagraphLayout(std::move(runs), buff, length);
}
/* static */ std::unique_ptr<icu::BreakIterator> ICUParagraphLayoutFactory::break_iterator;