diff options
| author | 2018-08-31 14:16:16 +0800 | |
|---|---|---|
| committer | 2018-12-18 22:54:41 +0100 | |
| commit | a2be49305d8c5c66cfa2ec2060688013cf3729b9 (patch) | |
| tree | 2a2e38805ae8af0718628682d7e911ccb253fc16 /src/video_core/renderer_base.cpp | |
| parent | Merge pull request #1868 from lioncash/config (diff) | |
| download | yuzu-a2be49305d8c5c66cfa2ec2060688013cf3729b9.tar.gz yuzu-a2be49305d8c5c66cfa2ec2060688013cf3729b9.tar.xz yuzu-a2be49305d8c5c66cfa2ec2060688013cf3729b9.zip | |
yuzu, video_core: Screenshot functionality
Allows capturing screenshot at the current internal resolution (native for software renderer), but a setting is available to capture it in other resolutions. The screenshot is saved to a single PNG in the current layout.
Diffstat (limited to 'src/video_core/renderer_base.cpp')
| -rw-r--r-- | src/video_core/renderer_base.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index 1482cdb40..94223f45f 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp | |||
| @@ -27,4 +27,16 @@ void RendererBase::UpdateCurrentFramebufferLayout() { | |||
| 27 | render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height); | 27 | render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | void RendererBase::RequestScreenshot(void* data, std::function<void()> callback, | ||
| 31 | const Layout::FramebufferLayout& layout) { | ||
| 32 | if (renderer_settings.screenshot_requested) { | ||
| 33 | LOG_ERROR(Render, "A screenshot is already requested or in progress, ignoring the request"); | ||
| 34 | return; | ||
| 35 | } | ||
| 36 | renderer_settings.screenshot_bits = data; | ||
| 37 | renderer_settings.screenshot_complete_callback = std::move(callback); | ||
| 38 | renderer_settings.screenshot_framebuffer_layout = layout; | ||
| 39 | renderer_settings.screenshot_requested = true; | ||
| 40 | } | ||
| 41 | |||
| 30 | } // namespace VideoCore | 42 | } // namespace VideoCore |