port forward of fixes from the stable version of rrd_cgi
[rrdtool.git] / src / rrd_gfx.c
index 103f213..12607d4 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.1.x  Copyright Tobias Oetiker, 1997 - 2002
+ * RRDtool 1.1.x  Copyright Tobias Oetiker, 1997 - 2003
  ****************************************************************************
  * rrd_gfx.c  graphics wrapper for rrdtool
   **************************************************************************/
@@ -313,8 +313,7 @@ double gfx_get_text_width_libart ( gfx_canvas_t *canvas,
   return text_width/64;
 }
 
-static void gfx_libart_close_path(gfx_canvas_t *canvas,
-       gfx_node_t *node, ArtVpath **vec)
+static void gfx_libart_close_path(gfx_node_t *node, ArtVpath **vec)
 {
     /* libart must have end==start for closed paths,
        even if using ART_MOVETO and not ART_MOVETO_OPEN
@@ -326,8 +325,7 @@ static void gfx_libart_close_path(gfx_canvas_t *canvas,
     art_vpath_add_point (vec, &points, &points_max, ART_END, 0, 0);
 }
 
-static void gfx_round_scaled_coordinates(gfx_canvas_t *canvas,
-       gfx_node_t *node, ArtVpath *vec)
+static void gfx_round_scaled_coordinates(ArtVpath *vec)
 {
     while (vec->code != ART_END) {
        vec->x = floor(vec->x - LINEOFFSET + 0.5) + LINEOFFSET;
@@ -503,8 +501,8 @@ int           gfx_render_png (gfx_canvas_t *canvas,
             art_affine_scale(dst,canvas->zoom,canvas->zoom);
             vec = art_vpath_affine_transform(node->path,dst);
            if (node->closed_path)
-               gfx_libart_close_path(canvas, node, &vec);
-           gfx_round_scaled_coordinates(canvas, node, vec);
+               gfx_libart_close_path(node, &vec);
+           gfx_round_scaled_coordinates(vec);
             if(node->type == GFX_LINE){
                 svp = art_svp_vpath_stroke ( vec, ART_PATH_STROKE_JOIN_ROUND,
                                              ART_PATH_STROKE_CAP_ROUND,
@@ -602,13 +600,13 @@ int           gfx_render_png (gfx_canvas_t *canvas,
                 gr = bit->bitmap.num_grays -1;
                 for (iy=0; iy < bit->bitmap.rows; iy++){
                     long buf_y = iy+(pen_y+0.5)-bit->top;
-                    if (buf_y < 0 || buf_y >= pys_height) continue;
+                    if (buf_y < 0 || buf_y >= (long)pys_height) continue;
                     buf_y *= rowstride;
                     for (ix=0;ix < bit->bitmap.width;ix++){
                         long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
                         art_u8 font_alpha;
                         
-                        if (buf_x < 0 || buf_x >= pys_width) continue;
+                        if (buf_x < 0 || buf_x >= (long)pys_width) continue;
                         buf_x *=  bytes_per_pixel ;
                         font_alpha =  *(bit->bitmap.buffer + iy * bit->bitmap.width + ix);
                         font_alpha =  (art_u8)((double)font_alpha / gr * falpha);
@@ -1116,8 +1114,11 @@ static void svg_text(FILE *fp, gfx_node_t *node)
    svg_write_number(fp, x);
    fputs("\" y=\"", fp);
    svg_write_number(fp, y);
-  if (strcmp(node->filename, svg_default_font))
+
+/*  if (strcmp(node->filename, svg_default_font))
     fprintf(fp, " font-family=\"%s\"", node->filename);
+    */
+   fputs("\" font-family=\"Helvetica", fp);
    fputs("\" font-size=\"", fp);
    svg_write_number(fp, node->size);
    fputs("\"", fp);
@@ -1303,7 +1304,7 @@ static int eps_prologue(eps_state *state)
     "%!PS-Adobe-3.0 EPSF-3.0\n"
     "%%Creator: RRDtool 1.1.x, Tobias Oetiker, http://tobi.oetiker.ch\n"
     /* can't like weird chars here */
-    "%%Title: (RRDTool output)\n"
+    "%%Title: (RRDtool output)\n"
     "%%DocumentData: Clean7Bit\n"
     "", state->fp);
   fprintf(state->fp, "%%%%BoundingBox: 0 0 %d %d\n",