mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Avoid unnecessary allocation of temporaries in layout line cache (#12737)
parent
d7eb29d292
commit
af7ad964dd
|
@ -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)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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).
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue