summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-01-09 04:27:16 +0100
committerPierre Bourdon <delroth@gmail.com>2016-01-09 04:27:16 +0100
commit39971ec03958dce195c43b285c97579736acaee8 (patch)
tree40a3bfd2c0cd545b80ebe56529e4598057fe9ed2 /Source/Core/VideoCommon/RenderBase.cpp
parentaf9beecc100895661377f63703111b3b41c56047 (diff)
parentc49a82bf0aa7ae9de1dd2ba24a5e35388552598c (diff)
Merge pull request #3472 from phire/TVs_dont_have_pixels
Rework the aspect ratio calculation (Fixes 240p mode)
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp38
1 files changed, 13 insertions, 25 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 5054fd61d5..76136c88aa 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -80,6 +80,7 @@ unsigned int Renderer::efb_scale_numeratorY = 1;
unsigned int Renderer::efb_scale_denominatorX = 1;
unsigned int Renderer::efb_scale_denominatorY = 1;
+static float AspectToWidescreen(float aspect) { return aspect * ((16.0f / 9.0f) / (4.0f / 3.0f)); }
Renderer::Renderer()
: frame_data()
@@ -427,7 +428,9 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
// 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 = VideoInterface::GetAspectRatio(Core::g_aspect_wide);
+ float source_aspect = VideoInterface::GetAspectRatio();
+ if (Core::g_aspect_wide)
+ source_aspect = AspectToWidescreen(source_aspect);
float target_aspect;
switch (g_ActiveConfig.iAspectRatio)
@@ -436,10 +439,10 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
target_aspect = WinWidth / WinHeight;
break;
case ASPECT_ANALOG:
- target_aspect = VideoInterface::GetAspectRatio(false);
+ target_aspect = VideoInterface::GetAspectRatio();
break;
case ASPECT_ANALOG_WIDE:
- target_aspect = VideoInterface::GetAspectRatio(true);
+ target_aspect = AspectToWidescreen(VideoInterface::GetAspectRatio());
break;
default:
// ASPECT_AUTO
@@ -472,17 +475,13 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
// The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio
float Ratio;
- switch (g_ActiveConfig.iAspectRatio)
+ if (g_ActiveConfig.iAspectRatio == ASPECT_ANALOG_WIDE || (g_ActiveConfig.iAspectRatio != ASPECT_ANALOG && Core::g_aspect_wide))
{
- 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(Core::g_aspect_wide);
- break;
+ Ratio = (WinWidth / WinHeight) / AspectToWidescreen(VideoInterface::GetAspectRatio());
+ }
+ else
+ {
+ Ratio = (WinWidth / WinHeight) / VideoInterface::GetAspectRatio();
}
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH)
@@ -508,18 +507,7 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
// ------------------
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop)
{
- 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 = (!Core::g_aspect_wide ? (4.0f / 3.0f) : (16.0f / 9.0f)) / VideoInterface::GetAspectRatio(Core::g_aspect_wide);
- break;
- }
+ Ratio = (4.0f / 3.0f) / VideoInterface::GetAspectRatio();
if (Ratio <= 1.0f)
{
Ratio = 1.0f / Ratio;