CommonHostInterface: Compress screenshots in background/use worker thread
This commit is contained in:
parent
125dfa7c40
commit
24fef20485
|
@ -2318,7 +2318,7 @@ void CommonHostInterface::StopDumpingAudio()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, bool full_resolution /* = true */,
|
bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, bool full_resolution /* = true */,
|
||||||
bool apply_aspect_ratio /* = true */)
|
bool apply_aspect_ratio /* = true */, bool compress_on_thread /* = true */)
|
||||||
{
|
{
|
||||||
if (System::IsShutdown())
|
if (System::IsShutdown())
|
||||||
return false;
|
return false;
|
||||||
|
@ -2342,7 +2342,14 @@ bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, b
|
||||||
filename = auto_filename.c_str();
|
filename = auto_filename.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool screenshot_saved = m_display->WriteDisplayTextureToFile(filename, full_resolution, apply_aspect_ratio);
|
if (FileSystem::FileExists(filename))
|
||||||
|
{
|
||||||
|
AddFormattedOSDMessage(10.0f, TranslateString("OSDMessage", "Screenshot file '%s' already exists."), filename);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool screenshot_saved =
|
||||||
|
m_display->WriteDisplayTextureToFile(filename, full_resolution, apply_aspect_ratio, compress_on_thread);
|
||||||
if (!screenshot_saved)
|
if (!screenshot_saved)
|
||||||
{
|
{
|
||||||
AddFormattedOSDMessage(10.0f, TranslateString("OSDMessage", "Failed to save screenshot to '%s'"), filename);
|
AddFormattedOSDMessage(10.0f, TranslateString("OSDMessage", "Failed to save screenshot to '%s'"), filename);
|
||||||
|
|
|
@ -151,7 +151,8 @@ public:
|
||||||
void StopDumpingAudio();
|
void StopDumpingAudio();
|
||||||
|
|
||||||
/// Saves a screenshot to the specified file. IF no file name is provided, one will be generated automatically.
|
/// Saves a screenshot to the specified file. IF no file name is provided, one will be generated automatically.
|
||||||
bool SaveScreenshot(const char* filename = nullptr, bool full_resolution = true, bool apply_aspect_ratio = true);
|
bool SaveScreenshot(const char* filename = nullptr, bool full_resolution = true, bool apply_aspect_ratio = true,
|
||||||
|
bool compress_on_thread = true);
|
||||||
|
|
||||||
/// Loads the cheat list from the specified file.
|
/// Loads the cheat list from the specified file.
|
||||||
bool LoadCheatList(const char* filename);
|
bool LoadCheatList(const char* filename);
|
||||||
|
|
Loading…
Reference in New Issue