Code

don't use round since it is c99 ... use floor(x+0.5) for positive numbers instead.
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sun, 6 May 2007 19:38:22 +0000 (19:38 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sun, 6 May 2007 19:38:22 +0000 (19:38 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1055 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_graph.c

index 35978cf6c7077682c600079a009e77c376f05942..22439b5771f174ee0e885cacc28540b9c2d6286c 100644 (file)
@@ -1673,8 +1673,8 @@ int draw_horizontal_grid(image_desc_t *im)
     for (i = sgrid; i <= egrid; i++){
        double Y0=ytr(im,im->ygrid_scale.gridstep*i);
        double YN=ytr(im,im->ygrid_scale.gridstep*(i+1));
-       if ( round(Y0) >= im->yorigin-im->ysize 
-            && round(Y0) <= im->yorigin){       
+       if ( floor(Y0+0.5) >= im->yorigin-im->ysize 
+            && floor(Y0+0.5) <= im->yorigin){       
             /* Make sure at least 2 grid labels are shown, even if it doesn't agree
                with the chosen settings. Add a label if required by settings, or if
                there is only one label so far and the next grid line is out of bounds. */
@@ -1837,7 +1837,7 @@ horizontal_log_grid(image_desc_t   *im)
         pre_value = value;
 
         Y0 = ytr(im, value);
-        if(round(Y0) <= im->yorigin - im->ysize) break;
+        if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
 
         /* major grid line */
         gfx_new_dashed_line ( im->canvas,
@@ -1897,7 +1897,7 @@ horizontal_log_grid(image_desc_t   *im)
                 if(value < im->minval) continue;
 
                 Y0 = ytr(im, value);
-                if(round(Y0) <= im->yorigin - im->ysize) break;
+                if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
 
                 /* draw lines */
                 gfx_new_dashed_line ( im->canvas,
@@ -1913,7 +1913,7 @@ horizontal_log_grid(image_desc_t   *im)
                 if(value < im->minval) continue;
 
                 Y0 = ytr(im, value);
-                if(round(Y0) <= im->yorigin - im->ysize) break;
+                if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
 
                 /* draw lines */
                 gfx_new_dashed_line ( im->canvas,
@@ -1954,7 +1954,7 @@ horizontal_log_grid(image_desc_t   *im)
             if(value < im->minval) continue;
 
             Y0 = ytr(im, value);
-            if(round(Y0) <= im->yorigin - im->ysize) break;
+            if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
 
             /* draw lines */
             gfx_new_dashed_line ( im->canvas,
@@ -1971,7 +1971,7 @@ horizontal_log_grid(image_desc_t   *im)
             if(value < im->minval) continue;
 
             Y0 = ytr(im, value);
-            if(round(Y0) <= im->yorigin - im->ysize) break;
+            if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
 
             /* draw lines */
             gfx_new_dashed_line ( im->canvas,