mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
VideoCommon/OnScreenDisplay: Use deduction guides for std::lock_guard
Same behavior without hardcoding the type of the mutex within the lock guards. This means the type of the mutex would be able to be changed without needing to also change all occurrences lock guards are used.
This commit is contained in:
parent
a565e41cb8
commit
3f947f086f
@ -80,14 +80,14 @@ static float DrawMessage(int index, const Message& msg, const ImVec2& position,
|
||||
|
||||
void AddTypedMessage(MessageType type, std::string message, u32 ms, u32 rgba)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_messages_mutex);
|
||||
std::lock_guard lock{s_messages_mutex};
|
||||
s_messages.erase(type);
|
||||
s_messages.emplace(type, Message(std::move(message), Common::Timer::GetTimeMs() + ms, rgba));
|
||||
}
|
||||
|
||||
void AddMessage(std::string message, u32 ms, u32 rgba)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_messages_mutex);
|
||||
std::lock_guard lock{s_messages_mutex};
|
||||
s_messages.emplace(MessageType::Typeless,
|
||||
Message(std::move(message), Common::Timer::GetTimeMs() + ms, rgba));
|
||||
}
|
||||
@ -98,7 +98,7 @@ void DrawMessages()
|
||||
return;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_messages_mutex);
|
||||
std::lock_guard lock{s_messages_mutex};
|
||||
|
||||
const u32 now = Common::Timer::GetTimeMs();
|
||||
float current_x = LEFT_MARGIN * ImGui::GetIO().DisplayFramebufferScale.x;
|
||||
@ -122,7 +122,7 @@ void DrawMessages()
|
||||
|
||||
void ClearMessages()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_messages_mutex);
|
||||
std::lock_guard lock{s_messages_mutex};
|
||||
s_messages.clear();
|
||||
}
|
||||
} // namespace OSD
|
||||
|
Loading…
Reference in New Issue
Block a user