summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2026-05-23 19:47:28 +0200
committerAdmiral H. Curtiss <pikachu025@gmail.com>2026-05-23 19:47:28 +0200
commit17b4b8fc07f9994f0f5596ef462730260e4595bb (patch)
tree3d5d1450ff266ae3bfec4a636277716541f0f4ad /Source/Core/VideoCommon
parenta5059cbca81c31fbbfceb2180b82eb59b0fe2fcb (diff)
Address minor nits in new cropping logic
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Present.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/Present.cpp b/Source/Core/VideoCommon/Present.cpp
index 7c26fb2b5d..601969454f 100644
--- a/Source/Core/VideoCommon/Present.cpp
+++ b/Source/Core/VideoCommon/Present.cpp
@@ -499,7 +499,6 @@ void Presenter::AdjustRectanglesToFitBounds(MathUtil::Rectangle<int>* target_rec
int fb_height)
{
const int efb_scale = g_framebuffer_manager->GetEFBScale();
- MathUtil::Rectangle<int> original_source_rect = *source_rect;
// Crop the content.
if (g_ActiveConfig.bCropCustom)
@@ -509,6 +508,7 @@ void Presenter::AdjustRectanglesToFitBounds(MathUtil::Rectangle<int>* target_rec
const int crop_top = g_ActiveConfig.iCropCustomTop * efb_scale;
const int crop_bottom = g_ActiveConfig.iCropCustomBottom * efb_scale;
+ const MathUtil::Rectangle<int> original_source_rect = *source_rect;
source_rect->left = std::min(source_rect->left + crop_left, source_rect->right);
source_rect->right = std::max(source_rect->right - crop_right, source_rect->left);
source_rect->top = std::min(source_rect->top + crop_top, source_rect->bottom);
@@ -529,21 +529,17 @@ void Presenter::AdjustRectanglesToFitBounds(MathUtil::Rectangle<int>* target_rec
}
// Center the content.
- const double source_aspect_ratio =
- static_cast<double>(source_rect->GetWidth()) / static_cast<double>(source_rect->GetHeight());
const double target_aspect_ratio =
static_cast<double>(target_rect->GetWidth()) / static_cast<double>(target_rect->GetHeight());
const double framebuffer_aspect_ratio =
static_cast<double>(fb_width) / static_cast<double>(fb_height);
- const double source_target_aspect_ratio = source_aspect_ratio / target_aspect_ratio;
- const double source_target_framebuffer_aspect_ratio =
- source_aspect_ratio / source_target_aspect_ratio / framebuffer_aspect_ratio;
+ const double target_framebuffer_aspect_ratio = target_aspect_ratio / framebuffer_aspect_ratio;
- if (source_target_framebuffer_aspect_ratio < 1)
+ if (target_framebuffer_aspect_ratio < 1)
{
// Width.
const int new_width =
- static_cast<double>(fb_width) * static_cast<double>(source_target_framebuffer_aspect_ratio);
+ static_cast<double>(fb_width) * static_cast<double>(target_framebuffer_aspect_ratio);
const int width_diff = fb_width - new_width;
const int half_width_diff = width_diff / 2;
@@ -561,8 +557,8 @@ void Presenter::AdjustRectanglesToFitBounds(MathUtil::Rectangle<int>* target_rec
target_rect->right = fb_width;
// Height.
- const int new_height = static_cast<double>(fb_height) /
- static_cast<double>(source_target_framebuffer_aspect_ratio);
+ const int new_height =
+ static_cast<double>(fb_height) / static_cast<double>(target_framebuffer_aspect_ratio);
const int height_diff = fb_height - new_height;
const int half_height_diff = height_diff / 2;
@@ -738,7 +734,7 @@ void Presenter::UpdateDrawRectangle()
// FIXME: this breaks at very low widget sizes
// Make ControllerInterface aware of the render window region actually being used
// to adjust mouse cursor inputs.
- // This also fails to acknowledge "g_ActiveConfig.bCrop".
+ // This also doesn't handle the image cropping settings.
g_controller_interface.SetAspectRatioAdjustment(draw_aspect_ratio / win_aspect_ratio);
float draw_width = draw_aspect_ratio;