mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 21:04:29 +01:00
Merge pull request #7389 from ameerj/screenshot-1x
Fix screenshot dimensions when at 1x scale
This commit is contained in:
commit
5082712b4e
@ -25,7 +25,12 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) {
|
|||||||
ASSERT(height > 0);
|
ASSERT(height > 0);
|
||||||
// The drawing code needs at least somewhat valid values for both screens
|
// The drawing code needs at least somewhat valid values for both screens
|
||||||
// so just calculate them both even if the other isn't showing.
|
// so just calculate them both even if the other isn't showing.
|
||||||
FramebufferLayout res{width, height, false, {}};
|
FramebufferLayout res{
|
||||||
|
.width = width,
|
||||||
|
.height = height,
|
||||||
|
.screen = {},
|
||||||
|
.is_srgb = false,
|
||||||
|
};
|
||||||
|
|
||||||
const float window_aspect_ratio = static_cast<float>(height) / static_cast<float>(width);
|
const float window_aspect_ratio = static_cast<float>(height) / static_cast<float>(width);
|
||||||
const float emulation_aspect_ratio = EmulationAspectRatio(
|
const float emulation_aspect_ratio = EmulationAspectRatio(
|
||||||
|
@ -35,17 +35,8 @@ enum class AspectRatio {
|
|||||||
struct FramebufferLayout {
|
struct FramebufferLayout {
|
||||||
u32 width{ScreenUndocked::Width};
|
u32 width{ScreenUndocked::Width};
|
||||||
u32 height{ScreenUndocked::Height};
|
u32 height{ScreenUndocked::Height};
|
||||||
bool is_srgb{};
|
|
||||||
|
|
||||||
Common::Rectangle<u32> screen;
|
Common::Rectangle<u32> screen;
|
||||||
|
bool is_srgb{};
|
||||||
/**
|
|
||||||
* Returns the ration of pixel size of the screen, compared to the native size of the undocked
|
|
||||||
* Switch screen.
|
|
||||||
*/
|
|
||||||
float GetScalingRatio() const {
|
|
||||||
return static_cast<float>(screen.GetWidth()) / ScreenUndocked::Width;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,10 +55,4 @@ std::unique_ptr<Tegra::GPU> CreateGPU(Core::Frontend::EmuWindow& emu_window, Cor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetResolutionScaleFactor(const RendererBase& renderer) {
|
|
||||||
return Settings::values.resolution_info.active
|
|
||||||
? Settings::values.resolution_info.up_factor
|
|
||||||
: renderer.GetRenderWindow().GetFramebufferLayout().GetScalingRatio();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace VideoCore
|
} // namespace VideoCore
|
||||||
|
@ -25,6 +25,4 @@ class RendererBase;
|
|||||||
/// Creates an emulated GPU instance using the given system context.
|
/// Creates an emulated GPU instance using the given system context.
|
||||||
std::unique_ptr<Tegra::GPU> CreateGPU(Core::Frontend::EmuWindow& emu_window, Core::System& system);
|
std::unique_ptr<Tegra::GPU> CreateGPU(Core::Frontend::EmuWindow& emu_window, Core::System& system);
|
||||||
|
|
||||||
float GetResolutionScaleFactor(const RendererBase& renderer);
|
|
||||||
|
|
||||||
} // namespace VideoCore
|
} // namespace VideoCore
|
||||||
|
@ -630,7 +630,7 @@ void GRenderWindow::ReleaseRenderTarget() {
|
|||||||
|
|
||||||
void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) {
|
void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) {
|
||||||
auto& renderer = system.Renderer();
|
auto& renderer = system.Renderer();
|
||||||
const f32 res_scale = VideoCore::GetResolutionScaleFactor(renderer);
|
const f32 res_scale = Settings::values.resolution_info.up_factor;
|
||||||
|
|
||||||
const Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale(res_scale)};
|
const Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale(res_scale)};
|
||||||
screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32);
|
screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32);
|
||||||
|
Loading…
Reference in New Issue
Block a user