From: Eli Zaretskii Date: Mon, 21 Aug 2017 14:46:42 +0000 (+0300) Subject: Avoid floating-point exceptions while drawing underwave X-Git-Tag: emacs-26.0.90~385 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=76fbe2f4541b11af8bcb0b5e57bb155b796b8d8e;p=emacs.git Avoid floating-point exceptions while drawing underwave * src/w32term.c (x_get_scale_factor): * src/xterm.c (x_get_scale_factor): Don't let the scale factors become less than 1. Reported by Yuri D'Elia in http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00459.html. --- diff --git a/src/w32term.c b/src/w32term.c index 6d2fa335859..2785ae2b52d 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -318,8 +318,10 @@ x_get_scale_factor(struct w32_display_info *dpyinfo, int *scale_x, int *scale_y) if (dpyinfo) { - *scale_x = floor (dpyinfo->resx / base_res); - *scale_y = floor (dpyinfo->resy / base_res); + if (dpyinfo->resx > base_res) + *scale_x = floor (dpyinfo->resx / base_res); + if (dpyinfo->resy > base_res) + *scale_y = floor (dpyinfo->resy / base_res); } } diff --git a/src/xterm.c b/src/xterm.c index 2efa70b1dca..77daa22ae0d 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3483,8 +3483,10 @@ x_get_scale_factor(Display *disp, int *scale_x, int *scale_y) if (dpyinfo) { - *scale_x = floor (dpyinfo->resx / base_res); - *scale_y = floor (dpyinfo->resy / base_res); + if (dpyinfo->resx > base_res) + *scale_x = floor (dpyinfo->resx / base_res); + if (dpyinfo->resy > base_res) + *scale_y = floor (dpyinfo->resy / base_res); } }