Video: Make the game resolution (within the window) snap to the XFB size if they are within a ~1 pixel treshold on one axis only.

This takes care of making the image clearer in some edge cases where the game was already running at near perfect
 4:3 with no stretching, and the VI aspect ratio didn't match the XFB by one pixel, making the image stretched and blurry.
-Video: Fix `FindClosestIntegerResolution() using the window aspect ratio and not the draw aspect ratio, causing it to prefer
 stretching over black bars in cases when it wasn't desirable.
This commit is contained in:
Filoppi
2023-12-18 01:00:47 +02:00
parent ccf2435047
commit 3f102ea8c2
3 changed files with 48 additions and 6 deletions

View File

@ -138,7 +138,8 @@ private:
u32 m_auto_resolution_scale = 1;
RcTcacheEntry m_xfb_entry;
MathUtil::Rectangle<int> m_xfb_rect;
// Internal resolution multiplier scaled XFB size
MathUtil::Rectangle<int> m_xfb_rect{0, 0, MAX_XFB_WIDTH, MAX_XFB_HEIGHT};
// Tracking of XFB textures so we don't render duplicate frames.
u64 m_last_xfb_id = std::numeric_limits<u64>::max();
@ -156,8 +157,10 @@ private:
// XFB tracking
u64 m_last_xfb_ticks = 0;
u32 m_last_xfb_addr = 0;
// Native XFB width
u32 m_last_xfb_width = MAX_XFB_WIDTH;
u32 m_last_xfb_stride = 0;
// Native XFB height
u32 m_last_xfb_height = MAX_XFB_HEIGHT;
Common::EventHook m_config_changed;