Perform screenshot processing (including image encode) on background tasks

This commit is contained in:
Henrik Rydgård committed 2025-03-20 20:48:51 +01:00
1 parent 14ee85139d
commit b421c0791f
8 files changed
+117 -62

No files matched your search

+10 -9
View File
@@ -182,21 +182,22 @@ ScreenRenderFlags ReportScreen::render(ScreenRenderMode mode) {
File::CreateDir(path);
}
screenshotFilename_ = path / ".reporting.jpg";
if (TakeGameScreenshot(screenManager()->getDrawContext(), screenshotFilename_, ScreenshotFormat::JPG, SCREENSHOT_DISPLAY, 4)) {
// Redo the views already, now with a screenshot included.
RecreateViews();
} else {
// Good news (?), the views are good as-is without a screenshot.
screenshotFilename_.clear();
}
ScreenshotResult ignored = TakeGameScreenshot(screenManager()->getDrawContext(), screenshotFilename_, ScreenshotFormat::JPG, SCREENSHOT_RENDER, 4, [this](bool success) {
if (success) {
// Redo the views already, now with a screenshot included.
RecreateViews();
} else {
// Good news (?), the views are good as-is without a screenshot.
screenshotFilename_.clear();
}
});
tookScreenshot_ = true;
}
}
// We take the screenshot first, then we start rendering.
// We are the only screen visible so this avoid starting and then trying to resume a backbuffer render pass.
ScreenRenderFlags flags = UIScreen::render(mode);
const ScreenRenderFlags flags = UIScreen::render(mode);
return flags;
}