X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_gfx.c;h=c4236dec9f0b886621adc0babe18aff2be08549d;hp=416b8a32ada2244d9567498688c920e6b526afb7;hb=0cab41a011f053fa84ac481849380f69ded26147;hpb=49593a6456b8dd4e82f82d8c76aaf21ce876ea92 diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c index 416b8a3..c4236de 100644 --- a/src/rrd_gfx.c +++ b/src/rrd_gfx.c @@ -329,10 +329,10 @@ void gfx_line_fit( line_width = cairo_get_line_width(cr); line_height = line_width; cairo_user_to_device_distance(cr, &line_width, &line_height); - line_width = line_width / 2.0 - (long) (line_width / 2.0); - line_height = line_height / 2.0 - (long) (line_height / 2.0); - *x = (double) ((long) (*x + 0.5)) - line_width; - *y = (double) ((long) (*y + 0.5)) + line_height; + line_width = line_width / 2.0 - ceil(line_width / 2.0); + line_height = line_height / 2.0 - ceil(line_height / 2.0); + *x = floor(*x - 0.5) - line_width; + *y = ceil(*y + 0.5) + line_height; cairo_device_to_user(cr, x, y); } @@ -348,7 +348,7 @@ void gfx_area_fit( if (!im->gridfit) return; cairo_user_to_device(cr, x, y); - *x = (double) ((long) (*x + 0.5)); - *y = (double) ((long) (*y + 0.5)); + *x = floor(*x); + *y = ceil(*y); cairo_device_to_user(cr, x, y); }