From d9275b77570562a94c726f3fe630886c96850396 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:42:28 -0400 Subject: yuzu-qt: Enable specifying screenshot resolution --- src/yuzu/bootmanager.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/yuzu/bootmanager.cpp') diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index bdd1497b5..593e59e8e 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -11,6 +11,8 @@ #include #include +#include "common/settings_enums.h" +#include "uisettings.h" #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA #include #include @@ -924,7 +926,19 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { return; } - const Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale(res_scale)}; + const Layout::FramebufferLayout layout{[res_scale]() { + if (UISettings::values.screenshot_height.GetValue() == 0 && + UISettings::values.screenshot_aspect_ratio.GetValue() == + Settings::ScreenshotAspectRatio::Auto) { + return Layout::FrameLayoutFromResolutionScale(res_scale); + } + const u32 height = UISettings::values.screenshot_height.GetValue(); + const u32 width = UISettings::CalculateWidth( + height, UISettings::ConvertScreenshotRatioToRatio( + UISettings::values.screenshot_aspect_ratio.GetValue())); + return Layout::DefaultFrameLayout(width, height); + }()}; + screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32); renderer.RequestScreenshot( screenshot_image.bits(), -- cgit v1.2.3