diff --git a/src/Backends/Rendering/OpenGL3.cpp b/src/Backends/Rendering/OpenGL3.cpp index c0af2db3..43593741 100644 --- a/src/Backends/Rendering/OpenGL3.cpp +++ b/src/Backends/Rendering/OpenGL3.cpp @@ -738,12 +738,12 @@ void RenderBackend_DrawScreen(void) GLsizei width; GLsizei height; - if ((float)actual_screen_width / (float)actual_screen_height > (float)framebuffer.width / (float)framebuffer.height) + if (actual_screen_width * framebuffer.height > framebuffer.width * actual_screen_height) // Fancy way to do `if (actual_screen_width / actual_screen_height > framebuffer.width / framebuffer.height)` without floats { y = 0; height = actual_screen_height; - width = framebuffer.width * ((float)actual_screen_height / (float)framebuffer.height); + width = (framebuffer.width * actual_screen_height) / framebuffer.height; x = (actual_screen_width - width) / 2; } else @@ -751,7 +751,7 @@ void RenderBackend_DrawScreen(void) x = 0; width = actual_screen_width; - height = framebuffer.height * ((float)actual_screen_width / (float)framebuffer.width); + height = (framebuffer.height * actual_screen_width) / framebuffer.width; y = (actual_screen_height - height) / 2; } diff --git a/src/Backends/Rendering/Window/Software/GLFW3.cpp b/src/Backends/Rendering/Window/Software/GLFW3.cpp index bff67da8..51014548 100644 --- a/src/Backends/Rendering/Window/Software/GLFW3.cpp +++ b/src/Backends/Rendering/Window/Software/GLFW3.cpp @@ -130,7 +130,7 @@ void WindowBackend_Software_HandleWindowResize(unsigned int width, unsigned int GLsizei viewport_width; GLsizei viewport_height; - if ((float)width / (float)height > (float)framebuffer_width / (float)framebuffer_height) + if (width * framebuffer_height > framebuffer_width * height) // Fancy way to do `if (width / height > framebuffer_width / framebuffer_height)` without floats { viewport_y = 0; viewport_height = height; diff --git a/src/Backends/Rendering/Window/Software/WiiU.cpp b/src/Backends/Rendering/Window/Software/WiiU.cpp index 41c805f0..8c64b527 100644 --- a/src/Backends/Rendering/Window/Software/WiiU.cpp +++ b/src/Backends/Rendering/Window/Software/WiiU.cpp @@ -50,12 +50,12 @@ static Viewport drc_viewport; static void CalculateViewport(unsigned int actual_screen_width, unsigned int actual_screen_height, Viewport *viewport) { - if ((float)actual_screen_width / (float)actual_screen_height > (float)fake_framebuffer_width / (float)fake_framebuffer_height) + if (actual_screen_width * fake_framebuffer_height > fake_framebuffer_width * actual_screen_height) // Fancy way to do `if (actual_screen_width / actual_screen_height > fake_framebuffer_width / fake_framebuffer_height)` without floats { viewport->y = 0.0f; viewport->height = actual_screen_height; - viewport->width = fake_framebuffer_width * ((float)actual_screen_height / (float)fake_framebuffer_height); + viewport->width = (fake_framebuffer_width * actual_screen_height) / fake_framebuffer_height; viewport->x = (actual_screen_width - viewport->width) / 2; } else @@ -63,7 +63,7 @@ static void CalculateViewport(unsigned int actual_screen_width, unsigned int act viewport->x = 0.0f; viewport->width = actual_screen_width; - viewport->height = fake_framebuffer_height * ((float)actual_screen_width / (float)fake_framebuffer_width); + viewport->height = (fake_framebuffer_height * actual_screen_width) / fake_framebuffer_width; viewport->y = (actual_screen_height - viewport->height) / 2; } }