[dia] [gtk-deprecated] Fix endless loop with grid stepping



commit d6c4d1ee6a918deb6b2363626974623a8ff93c80
Author: Hans Breuer <hans breuer org>
Date:   Sat Sep 27 11:47:49 2014 +0200

    [gtk-deprecated] Fix endless loop with grid stepping
    
    commit 5a788e5ebe93b72a787319d1204f72ebb9aabd0a introduced a potential
    endless loop with grid_step() and DiaRuler to "compensate for missing
    5 and 6 in 3,4,..,7,8 major ticks". The rounding problem can be solved
    more correctly with ROUND(), rather than potentially doing the same
    step over and over again.

 app/grid.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/app/grid.c b/app/grid.c
index 5c31f1c..7ac60c0 100644
--- a/app/grid.c
+++ b/app/grid.c
@@ -62,11 +62,8 @@ grid_step (DDisplay *ddisp, GtkOrientation orientation,
 
   /* length from the diagram settings - but always dynamic */
   calculate_dynamic_grid (ddisp, &length, &length);
-  pos = ceil(*start / length) * length;
-
-  /* compensate for missing 5 and 6 in 3,4,..,7,8 major ticks */
-  if (fmod(*start, length) == fmod(pos, length))
-    pos += length;
+  pos = ROUND(*start / length) * length;
+  pos += length;
   if (major_lines) {
     major_count = ROUND (pos/length);
     if(major_count < 0) major_count -= major_lines * major_count;


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