mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
VideoCommon/NetPlayChatUI: Take std::string by value in AppendChat()
Given we're simply storing the std::string into a deque. We can emplace it and move it. Completely avoiding copies with the current usage of the function.
This commit is contained in:
@ -78,12 +78,12 @@ void NetPlayChatUI::Display()
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void NetPlayChatUI::AppendChat(const std::string& message, NetPlayChatUI::Color color)
|
||||
void NetPlayChatUI::AppendChat(std::string message, Color color)
|
||||
{
|
||||
if (m_messages.size() > MAX_BACKLOG_SIZE)
|
||||
m_messages.pop_front();
|
||||
|
||||
m_messages.push_back({message, color});
|
||||
m_messages.emplace_back(std::move(message), color);
|
||||
|
||||
// Only scroll to bottom, if we were at the bottom previously
|
||||
if (m_is_scrolled_to_bottom)
|
||||
|
Reference in New Issue
Block a user