mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-26 00:45:35 +00:00
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:
@@ -113,7 +113,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
UniscribeParagraphLayout(std::vector<UniscribeRun> &ranges, const UniscribeParagraphLayoutFactory::CharType *buffer) : text_buffer(buffer), ranges(ranges)
|
||||
UniscribeParagraphLayout(std::vector<UniscribeRun> &&ranges, const UniscribeParagraphLayoutFactory::CharType *buffer) : text_buffer(buffer), ranges(std::move(ranges))
|
||||
{
|
||||
this->Reflow();
|
||||
}
|
||||
@@ -315,7 +315,7 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
}
|
||||
}
|
||||
|
||||
return new UniscribeParagraphLayout(ranges, buff);
|
||||
return new UniscribeParagraphLayout(std::move(ranges), buff);
|
||||
}
|
||||
|
||||
/* virtual */ std::unique_ptr<const ParagraphLayouter::Line> UniscribeParagraphLayout::NextLine(int max_width)
|
||||
|
||||
Reference in New Issue
Block a user