Code

control: Updated standards-version to 3.9.5 -- no changes.
[pkg-rrdtool.git] / src / rrd_gfx.c
index 941cfd1be22239db8534b62354928b13d2aa4e9d..edc4fb6e3555beda177a114445aa2b13af38763a 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.3.5  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.4.8  Copyright by Tobi Oetiker, 1997-2013
  ****************************************************************************
  * rrd_gfx.c  graphics wrapper for rrdtool
   **************************************************************************/
@@ -124,7 +124,7 @@ static PangoLayout *gfx_prep_text(
     const char *text)
 {
     PangoLayout  *layout = im->layout;
-    PangoFontDescription *pfd;
+    const PangoFontDescription *pfd;
     cairo_t  *cr = im->cr;
 
     static double last_tabwidth = -1;
@@ -154,7 +154,7 @@ static PangoLayout *gfx_prep_text(
         pango_layout_set_tabs(layout, tab_array);
         pango_tab_array_free(tab_array);
     }
-   pfd = (PangoFontDescription*)(pango_layout_get_font_description(layout));
+   pfd = pango_layout_get_font_description(layout);
 
    if (!pfd || !pango_font_description_equal (pfd,font_desc)){
         pango_layout_set_font_description(layout, font_desc);
@@ -293,10 +293,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);
 }
 
@@ -312,7 +312,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);
 }