Video: polish aspect ratio related code comments to make it clearer

This commit is contained in:
Filoppi
2023-09-09 15:48:37 +03:00
parent b4bfc4feba
commit 24004af814
7 changed files with 20 additions and 12 deletions

View File

@ -46,7 +46,7 @@ public:
void ConfigChanged(u32 changed_bits);
// Display resolution
// Window resolution (display resolution if fullscreen)
int GetBackbufferWidth() const { return m_backbuffer_width; }
int GetBackbufferHeight() const { return m_backbuffer_height; }
float GetBackbufferScale() const { return m_backbuffer_scale; }
@ -58,6 +58,7 @@ public:
void UpdateDrawRectangle();
// Returns the target aspect ratio the XFB output should be drawn with.
float CalculateDrawAspectRatio(bool allow_stretch = true) const;
// Crops the target rectangle to the framebuffer dimensions, reducing the size of the source
@ -126,6 +127,9 @@ private:
Common::Flag m_surface_changed;
Common::Flag m_surface_resized;
// The presentation rectangle.
// Width and height correspond to the final output resolution.
// Offsets imply black borders (if the window aspect ratio doesn't match the game's one).
MathUtil::Rectangle<int> m_target_rectangle = {};
RcTcacheEntry m_xfb_entry;

View File

@ -91,8 +91,9 @@ static bool IsAnamorphicProjection(const Projection::Raw& projection, const View
const VideoConfig& config)
{
// If ratio between our projection and viewport aspect ratios is similar to 16:9 / 4:3
// we have an anamorphic projection. This value can be overridden
// by a GameINI.
// we have an anamorphic projection. This value can be overridden by a GameINI.
// Game cheats that change the aspect ratio to natively unsupported ones
// won't be automatically recognized here.
return std::abs(CalculateProjectionViewportRatio(projection, viewport) -
config.widescreen_heuristic_widescreen_ratio) <

View File

@ -53,6 +53,7 @@ void WidescreenManager::Update()
}
// Heuristic to detect if a GameCube game is in 16:9 anamorphic widescreen mode.
// Cheats that change the game aspect ratio to natively unsupported ones won't be recognized here.
void WidescreenManager::UpdateWidescreenHeuristic()
{
const auto flush_statistics = g_vertex_manager->ResetFlushAspectRatioCount();

View File

@ -11,11 +11,14 @@
class PointerWrap;
// This class is responsible for tracking the game's aspect ratio.
// This exclusively supports 4:3 or 16:9 detection by default.
class WidescreenManager
{
public:
WidescreenManager();
// Just a helper to tell whether the game seems to be running in widescreen,
// or if it's being forced to.
bool IsGameWidescreen() const { return m_is_game_widescreen; }
void DoState(PointerWrap& p);