Merge pull request #9013 from JosJuice/savescreenshot-wait-for-completion

Remove wait_for_completion parameter from Renderer::SaveScreenshot
This commit is contained in:
LC 2020-08-06 19:44:43 -04:00 committed by GitHub
commit de5d0e54be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 21 deletions

View File

@ -713,26 +713,25 @@ static std::string GenerateScreenshotName()
return name; return name;
} }
void SaveScreenShot(bool wait_for_completion) void SaveScreenShot()
{ {
const bool bPaused = GetState() == State::Paused; const bool bPaused = GetState() == State::Paused;
SetState(State::Paused); SetState(State::Paused);
g_renderer->SaveScreenshot(GenerateScreenshotName(), wait_for_completion); g_renderer->SaveScreenshot(GenerateScreenshotName());
if (!bPaused) if (!bPaused)
SetState(State::Running); SetState(State::Running);
} }
void SaveScreenShot(std::string_view name, bool wait_for_completion) void SaveScreenShot(std::string_view name)
{ {
const bool bPaused = GetState() == State::Paused; const bool bPaused = GetState() == State::Paused;
SetState(State::Paused); SetState(State::Paused);
g_renderer->SaveScreenshot(fmt::format("{}{}.png", GenerateScreenshotFolderPath(), name), g_renderer->SaveScreenshot(fmt::format("{}{}.png", GenerateScreenshotFolderPath(), name));
wait_for_completion);
if (!bPaused) if (!bPaused)
SetState(State::Running); SetState(State::Running);

View File

@ -112,8 +112,8 @@ void SetState(State state);
State GetState(); State GetState();
void WaitUntilDoneBooting(); void WaitUntilDoneBooting();
void SaveScreenShot(bool wait_for_completion = false); void SaveScreenShot();
void SaveScreenShot(std::string_view name, bool wait_for_completion = false); void SaveScreenShot(std::string_view name);
void Callback_WiimoteInterruptChannel(int number, u16 channel_id, const u8* data, u32 size); void Callback_WiimoteInterruptChannel(int number, u16 channel_id, const u8* data, u32 size);

View File

@ -378,20 +378,11 @@ Renderer::ConvertStereoRectangle(const MathUtil::Rectangle<int>& rc) const
return std::make_tuple(left_rc, right_rc); return std::make_tuple(left_rc, right_rc);
} }
void Renderer::SaveScreenshot(std::string filename, bool wait_for_completion) void Renderer::SaveScreenshot(std::string filename)
{ {
// We must not hold the lock while waiting for the screenshot to complete. std::lock_guard<std::mutex> lk(m_screenshot_lock);
{ m_screenshot_name = std::move(filename);
std::lock_guard<std::mutex> lk(m_screenshot_lock); m_screenshot_request.Set();
m_screenshot_name = std::move(filename);
m_screenshot_request.Set();
}
if (wait_for_completion)
{
// This is currently only used by Android, and it was using a wait time of 2 seconds.
m_screenshot_completed.WaitFor(std::chrono::seconds(2));
}
} }
void Renderer::CheckForConfigChanges() void Renderer::CheckForConfigChanges()

View File

@ -199,7 +199,7 @@ public:
float EFBToScaledYf(float y) const; float EFBToScaledYf(float y) const;
// Random utilities // Random utilities
void SaveScreenshot(std::string filename, bool wait_for_completion); void SaveScreenshot(std::string filename);
void DrawDebugText(); void DrawDebugText();
virtual void ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable, virtual void ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable,