[qt] fix aspect ratio enum mismatch for framebuffer (#2792)

the framebuffer:
```c++
enum class AspectRatio {
    Default,
    R4_3,
    R21_9,
    R16_10,
    StretchToWindow,
};
```
the actual enum
```c++
ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch);
```
If someone were to add a new setting it would likely cause catastrophe.

1280/720 = 16/9

Signed-off-by: lizzie <lizzie@eden-emu.dev>

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2792
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: crueter <crueter@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2025-10-21 21:39:09 +02:00 committed by crueter
parent df26fe2cac
commit d0206c35fb
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
4 changed files with 48 additions and 87 deletions

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -6,6 +9,10 @@
#include "common/common_types.h"
#include "common/math_util.h"
namespace Settings {
enum class AspectRatio : u32;
}
namespace Layout {
namespace MinimumSize {
@ -23,15 +30,7 @@ constexpr u32 Width = 1920;
constexpr u32 Height = 1080;
} // namespace ScreenDocked
enum class AspectRatio {
Default,
R4_3,
R21_9,
R16_10,
StretchToWindow,
};
/// Describes the layout of the window framebuffer
/// @brief Describes the layout of the window framebuffer
struct FramebufferLayout {
u32 width{ScreenUndocked::Width};
u32 height{ScreenUndocked::Height};
@ -39,26 +38,7 @@ struct FramebufferLayout {
bool is_srgb{};
};
/**
* Factory method for constructing a default FramebufferLayout
* @param width Window framebuffer width in pixels
* @param height Window framebuffer height in pixels
* @return Newly created FramebufferLayout object with default screen regions initialized
*/
FramebufferLayout DefaultFrameLayout(u32 width, u32 height);
/**
* Convenience method to get frame layout by resolution scale
* @param res_scale resolution scale factor
*/
FramebufferLayout FrameLayoutFromResolutionScale(f32 res_scale);
/**
* Convenience method to determine emulation aspect ratio
* @param aspect Represents the index of aspect ratio stored in Settings::values.aspect_ratio
* @param window_aspect_ratio Current window aspect ratio
* @return Emulation render window aspect ratio
*/
float EmulationAspectRatio(AspectRatio aspect, float window_aspect_ratio);
FramebufferLayout DefaultFrameLayout(u32 width, u32 height) noexcept;
float EmulationAspectRatio(Settings::AspectRatio aspect, float window_aspect_ratio) noexcept;
} // namespace Layout