]> granicus.if.org Git - graphviz/commitdiff
core POV: treat 'layerz' and 'z' as ints
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 8 Nov 2022 02:22:58 +0000 (18:22 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 11 Nov 2022 01:09:34 +0000 (17:09 -0800)
It is not clear why these were floats as they were operated on as ints. This
squashes the compiler warning:

  gvrender_core_pov.c: In function ‘pov_begin_layer’:
  gvrender_core_pov.c:459:18: warning: conversion from ‘int’ to ‘float’ may
    change value [-Wconversion]
    459 |         layerz = layerNum * -10;
        |                  ^~~~~~~~

plugin/core/gvrender_core_pov.c

index 8a9d2950a131390ff4321a2ea3807bec80475c04..f52a81c341d74922051e7bec65c838b4e5c10fef 100644 (file)
     "rotate   "POV_VECTOR3"\n"
 
 #define POV_TRANSLATE \
-    "translate"POV_VECTOR3"\n"
+    "translate<%9.3f, %9.3f, %d.000>\n"
 
 #define END \
     "}\n"
@@ -312,8 +312,8 @@ typedef enum { FORMAT_POV, } format_type;
 
 static char *pov_knowncolors[] = { POV_COLORS };
 
-static float layerz = 0;
-static float z = 0;
+static int layerz = 0;
+static int z = 0;
 
 static char *el(GVJ_t* job, char *template, ...)
 {
@@ -500,7 +500,7 @@ static void pov_begin_edge(GVJ_t * job)
        gvputs(job, "//*** begin_edge\n");
        layerz -= 5;
 #ifdef DEBUG
-       gvprintf(job, "// layerz = %.3f\n", layerz);
+       gvprintf(job, "// layerz = %d.000\n", layerz);
 #endif
 }
 
@@ -509,7 +509,7 @@ static void pov_end_edge(GVJ_t * job)
        gvputs(job, "//*** end_edge\n");
        layerz += 5;
 #ifdef DEBUG
-       gvprintf(job, "// layerz = %.3f\n", layerz);
+       gvprintf(job, "// layerz = %d.000\n", layerz);
 #endif
 }
 
@@ -555,7 +555,7 @@ static void pov_textspan(GVJ_t * job, pointf c, textspan_t * span)
 
 #ifdef DEBUG
        GV_OBJ_EXT("Text", pov, span->str);
-       gvprintf(job, "sphere{<0, 0, 0>, 2\ntranslate<%f, %f, %f>\n"
+       gvprintf(job, "sphere{<0, 0, 0>, 2\ntranslate<%f, %f, %d>\n"
                 "pigment{color Red}\nno_shadow\n}\n", x, y, z - 1);
 #else
        gvputs(job, pov);
@@ -594,7 +594,7 @@ static void pov_ellipse(GVJ_t * job, pointf * A, int filled)
 
 #ifdef DEBUG
        GV_OBJ_EXT("Torus", pov, "");
-       gvprintf(job, "sphere{<0, 0, 0>, 2\ntranslate<%f, %f, %f>\n"
+       gvprintf(job, "sphere{<0, 0, 0>, 2\ntranslate<%f, %f, %d>\n"
                 "pigment{color Green}\nno_shadow\n}\n", cx, cy, z - 1);
 #else
        gvputs(job, pov);
@@ -664,7 +664,7 @@ static void pov_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
                        pov = x;
                }
 #ifdef DEBUG
-               gvprintf(job, "sphere{<0, 0, 0>, 2\ntranslate<%f, %f, %f>\n"
+               gvprintf(job, "sphere{<0, 0, 0>, 2\ntranslate<%f, %f, %d>\n"
                         "pigment{color Yellow}\nno_shadow\n}\n",
                         (A[i].x + job->translation.x) * job->scale.x,
                         (A[i].y + job->translation.y) * job->scale.y, z - 2);