diff options
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.cpp | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 817213504a..77ba795d48 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -28,6 +28,8 @@ #include "Core/Movie.h" #include "Core/FifoPlayer/FifoRecorder.h" +#include "Core/HW/VideoInterface.h" + #include "VideoCommon/AVIDump.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/CommandProcessor.h" @@ -44,6 +46,7 @@ #include "VideoCommon/VideoConfig.h" #include "VideoCommon/XFMemory.h" + // TODO: Move these out of here. int frameCount; int OSDChoice; @@ -360,15 +363,14 @@ void Renderer::DrawDebugText() case ASPECT_AUTO: ar_text = "Auto"; break; - case ASPECT_FORCE_16_9: - ar_text = "16:9"; - break; - case ASPECT_FORCE_4_3: - ar_text = "4:3"; - break; case ASPECT_STRETCH: ar_text = "Stretch"; break; + case ASPECT_ANALOG: + ar_text = "Force 4:3"; + break; + case ASPECT_ANALOG_WIDE: + ar_text = "Force 16:9"; } const char* const efbcopy_text = g_ActiveConfig.bSkipEFBCopyToRam ? "to Texture" : "to RAM"; @@ -425,31 +427,27 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) const float WinWidth = FloatGLWidth; const float WinHeight = FloatGLHeight; - // Handle aspect ratio. - // Default to auto. - bool use16_9 = g_aspect_wide; - // Update aspect ratio hack values // Won't take effect until next frame // Don't know if there is a better place for this code so there isn't a 1 frame delay if (g_ActiveConfig.bWidescreenHack) { - float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f); + float source_aspect = VideoInterface::GetAspectRatio(g_aspect_wide); float target_aspect; switch (g_ActiveConfig.iAspectRatio) { - case ASPECT_FORCE_16_9: - target_aspect = 16.0f / 9.0f; - break; - case ASPECT_FORCE_4_3: - target_aspect = 4.0f / 3.0f; - break; case ASPECT_STRETCH: target_aspect = WinWidth / WinHeight; break; + case ASPECT_ANALOG: + target_aspect = VideoInterface::GetAspectRatio(false); + break; + case ASPECT_ANALOG_WIDE: + target_aspect = VideoInterface::GetAspectRatio(true); + break; default: - // ASPECT_AUTO == no hacking + // ASPECT_AUTO target_aspect = source_aspect; break; } @@ -476,16 +474,23 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) } // Check for force-settings and override. - if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9) - use16_9 = true; - else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3) - use16_9 = false; + // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio + float Ratio; + switch (g_ActiveConfig.iAspectRatio) + { + case ASPECT_ANALOG_WIDE: + Ratio = (WinWidth / WinHeight) / VideoInterface::GetAspectRatio(true); + break; + case ASPECT_ANALOG: + Ratio = (WinWidth / WinHeight) / VideoInterface::GetAspectRatio(false); + break; + default: + Ratio = (WinWidth / WinHeight) / VideoInterface::GetAspectRatio(g_aspect_wide); + break; + } if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH) { - // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio - float Ratio = (WinWidth / WinHeight) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f)); - // Check if height or width is the limiting factor. If ratio > 1 the picture is too wide and have to limit the width. if (Ratio > 1.0f) { // Scale down and center in the X direction. @@ -502,12 +507,27 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) } // ----------------------------------------------------------------------- - // Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10. + // Crop the picture from Analog to 4:3 or from Analog (Wide) to 16:9. // Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset // ------------------ if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop) { - float Ratio = !use16_9 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f))); + switch (g_ActiveConfig.iAspectRatio) + { + case ASPECT_ANALOG_WIDE: + Ratio = (16.0f / 9.0f) / VideoInterface::GetAspectRatio(true); + break; + case ASPECT_ANALOG: + Ratio = (4.0f / 3.0f) / VideoInterface::GetAspectRatio(false); + break; + default: + Ratio = (!g_aspect_wide ? (4.0f / 3.0f) : (16.0f / 9.0f)) / VideoInterface::GetAspectRatio(g_aspect_wide); + break; + } + if (Ratio <= 1.0f) + { + Ratio = 1.0f / Ratio; + } // The width and height we will add (calculate this before FloatGLWidth and FloatGLHeight is adjusted) float IncreasedWidth = (Ratio - 1.0f) * FloatGLWidth; float IncreasedHeight = (Ratio - 1.0f) * FloatGLHeight; |
