From 95b33ee0a7c9e792863aab5b9eca06973afc68e4 Mon Sep 17 00:00:00 2001 From: vaguilar Date: Sun, 30 Nov 2014 00:48:10 -0800 Subject: Fixed viewport error caused by rounding --- src/video_core/renderer_opengl/renderer_opengl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/video_core/renderer_opengl') diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index abbb4c2cb..fd44c3f68 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -240,14 +240,14 @@ MathUtil::Rectangle RendererOpenGL::GetViewportExtent() { MathUtil::Rectangle viewport_extent; if (window_aspect_ratio > emulation_aspect_ratio) { // Window is narrower than the emulation content => apply borders to the top and bottom - unsigned viewport_height = emulation_aspect_ratio * framebuffer_width; + unsigned viewport_height = std::round(emulation_aspect_ratio * framebuffer_width); viewport_extent.left = 0; viewport_extent.top = (framebuffer_height - viewport_height) / 2; viewport_extent.right = viewport_extent.left + framebuffer_width; viewport_extent.bottom = viewport_extent.top + viewport_height; } else { // Otherwise, apply borders to the left and right sides of the window. - unsigned viewport_width = framebuffer_height / emulation_aspect_ratio; + unsigned viewport_width = std::round(framebuffer_height / emulation_aspect_ratio); viewport_extent.left = (framebuffer_width - viewport_width) / 2; viewport_extent.top = 0; viewport_extent.right = viewport_extent.left + viewport_width; -- cgit v1.2.3