1
0
Fork 0

Codechange: Avoid unnecessary allocation of temporaries in layout line cache (#12737)

pull/12771/head
Jonathan G Rennison 2024-06-08 21:21:02 +01:00 committed by GitHub
parent d7eb29d292
commit af7ad964dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -388,7 +388,7 @@ Layouter::LineCacheItem &Layouter::GetCachedParagraphLayout(std::string_view str
LineCacheKey key;
key.state_before = state;
key.str.assign(str);
return (*linecache)[key];
return (*linecache)[std::move(key)];
}
/**

View File

@ -132,7 +132,7 @@ class Layouter : public std::vector<std::unique_ptr<const ParagraphLayouter::Lin
};
struct LineCacheQuery {
FontState state_before; ///< Font state at the beginning of the line.
const FontState &state_before; ///< Font state at the beginning of the line.
std::string_view str; ///< Source string of the line (including colour and font size codes).
};