From 8d5385d1d77d8367969cdc514120ca62373b700e Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Fri, 9 Mar 2012 01:21:10 +0100 Subject: [PATCH] (PS3) Aspect ratio fix --- ps3/ps3_video_psgl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ps3/ps3_video_psgl.c b/ps3/ps3_video_psgl.c index c095943568..a5e5fbf244 100644 --- a/ps3/ps3_video_psgl.c +++ b/ps3/ps3_video_psgl.c @@ -439,11 +439,12 @@ static void set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_f { float desired_aspect = g_settings.video.aspect_ratio; float device_aspect = (float)width / height; - float delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5; + float delta; // If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff), if(g_console.aspect_ratio_index == ASPECT_RATIO_CUSTOM) { + delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5; m_viewport_x_temp = g_console.custom_viewport_x; m_viewport_y_temp = g_console.custom_viewport_y; m_viewport_width_temp = g_console.custom_viewport_width; @@ -451,12 +452,14 @@ static void set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_f } else if (device_aspect > desired_aspect) { + delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5; m_viewport_x_temp = (GLint)(width * (0.5 - delta)); m_viewport_width_temp = (GLint)(2.0 * width * delta); width = (unsigned)(2.0 * width * delta); } else { + delta = (device_aspect / desired_aspect - 1.0) / 2.0 + 0.5; m_viewport_y_temp = (GLint)(height * (0.5 - delta)); m_viewport_height_temp = (GLint)(2.0 * height * delta); height = (unsigned)(2.0 * height * delta);