From 696c0025c80da3e412f715915fe5a074e5fe0668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Fri, 14 May 2021 20:00:36 -0400 Subject: [PATCH] Use lround(), not roundl(). Also, include math.h --- src/conio/sdl_con.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/conio/sdl_con.c b/src/conio/sdl_con.c index da3ddeaf6d..3a79a37131 100644 --- a/src/conio/sdl_con.c +++ b/src/conio/sdl_con.c @@ -1,3 +1,4 @@ +#include <math.h> #include <stdarg.h> #include <stdbool.h> #include <stdio.h> /* NULL */ @@ -567,8 +568,8 @@ static void setup_surfaces_locked(void) cols = cvstat.cols; rows = cvstat.rows; vmultiplier = cvstat.vmultiplier; - idealh = roundl((long double)cvstat.winwidth * cvstat.scale_denominator / cvstat.scale_numerator * cvstat.scrnheight / cvstat.scrnwidth); - idealmh = roundl((long double)cvstat.scrnwidth * cvstat.scale_denominator / cvstat.scale_numerator * cvstat.scrnheight / cvstat.scrnwidth); + idealh = lround((long double)cvstat.winwidth * cvstat.scale_denominator / cvstat.scale_numerator * cvstat.scrnheight / cvstat.scrnwidth); + idealmh = lround((long double)cvstat.scrnwidth * cvstat.scale_denominator / cvstat.scale_numerator * cvstat.scrnheight / cvstat.scrnwidth); internal_scaling = true; sdl.SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); @@ -1100,8 +1101,8 @@ void sdl_video_event_thread(void *data) dst.w = cvstat.winwidth; dst.h = cvstat.winheight; // Get correct aspect ratio for dst... - idealw = roundl((long double)dst.h * cvstat.scale_numerator / cvstat.scale_denominator * cvstat.scrnwidth / cvstat.scrnheight); - idealh = roundl((long double)dst.w * cvstat.scale_denominator / cvstat.scale_numerator * cvstat.scrnheight / cvstat.scrnwidth); + idealw = lround((long double)dst.h * cvstat.scale_numerator / cvstat.scale_denominator * cvstat.scrnwidth / cvstat.scrnheight); + idealh = lround((long double)dst.w * cvstat.scale_denominator / cvstat.scale_numerator * cvstat.scrnheight / cvstat.scrnwidth); if (idealw < cvstat.winwidth) { dst.x = (cvstat.winwidth - idealw) / 2; dst.w = idealw; -- GitLab