yuzu-qt: Enable specifying screenshot resolution

This commit is contained in:
lat9nq
2023-08-15 22:42:28 -04:00
parent 3e28e85468
commit d9275b7757
5 changed files with 200 additions and 5 deletions

View File

@ -11,6 +11,8 @@
#include <glad/glad.h>
#include <QtCore/qglobal.h>
#include "common/settings_enums.h"
#include "uisettings.h"
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA
#include <QCamera>
#include <QCameraImageCapture>
@ -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(),