emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 76fbe2f: Avoid floating-point exceptions while draw


From: Eli Zaretskii
Subject: [Emacs-diffs] master 76fbe2f: Avoid floating-point exceptions while drawing underwave
Date: Mon, 21 Aug 2017 10:49:39 -0400 (EDT)

branch: master
commit 76fbe2f4541b11af8bcb0b5e57bb155b796b8d8e
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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 <address@hidden> in
    http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00459.html.
---
 src/w32term.c | 6 ++++--
 src/xterm.c   | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/w32term.c b/src/w32term.c
index 6d2fa33..2785ae2 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 2efa70b..77daa22 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);
     }
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]