diff options
Diffstat (limited to 'src/display/canvas-axonomgrid.cpp')
| -rw-r--r-- | src/display/canvas-axonomgrid.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index dbf7b424d..ec2d35f69 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -33,6 +33,7 @@ #include "svg/svg-color.h" #include "util/mathfns.h" #include "xml/node-event-vector.h" +#include "round.h" #define SAFE_SETPIXEL //undefine this when it is certain that setpixel is never called with invalid params @@ -549,13 +550,13 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) // x-axis always goes from topleft to bottomright. (0,0) - (1,1) gdouble const xintercept_y_bc = (buf_tl_gc[Geom::X] * tan_angle[X]) - buf_tl_gc[Geom::Y] ; gdouble const xstart_y_sc = ( xintercept_y_bc - floor(xintercept_y_bc/lyw)*lyw ) + buf->rect.y0; - gint const xlinestart = (gint) Inkscape::round( (xstart_y_sc - buf->rect.x0*tan_angle[X] -ow[Geom::Y]) / lyw ); + gint const xlinestart = round( (xstart_y_sc - buf->rect.x0*tan_angle[X] -ow[Geom::Y]) / lyw ); gint xlinenum = xlinestart; // lines starting on left side. for (y = xstart_y_sc; y < buf->rect.y1; y += lyw, xlinenum++) { gint const x0 = buf->rect.x0; - gint const y0 = (gint) Inkscape::round(y); - gint const x1 = x0 + (gint) Inkscape::round( (buf->rect.y1 - y) / tan_angle[X] ); + gint const y0 = round(y); + gint const x1 = x0 + round( (buf->rect.y1 - y) / tan_angle[X] ); gint const y1 = buf->rect.y1; if (!scaled && (xlinenum % empspacing) != 0) { @@ -570,8 +571,8 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) for (x = xstart_x_sc; x < buf->rect.x1; x += lxw_x, xlinenum--) { gint const y0 = buf->rect.y0; gint const y1 = buf->rect.y1; - gint const x0 = (gint) Inkscape::round(x); - gint const x1 = x0 + (gint) Inkscape::round( (y1 - y0) / tan_angle[X] ); + gint const x0 = round(x); + gint const x1 = x0 + round( (y1 - y0) / tan_angle[X] ); if (!scaled && (xlinenum % empspacing) != 0) { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); @@ -582,10 +583,10 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) // y-axis lines (vertical) gdouble const ystart_x_sc = floor (buf_tl_gc[Geom::X] / spacing_ylines) * spacing_ylines + ow[Geom::X]; - gint const ylinestart = (gint) Inkscape::round((ystart_x_sc - ow[Geom::X]) / spacing_ylines); + gint const ylinestart = round((ystart_x_sc - ow[Geom::X]) / spacing_ylines); gint ylinenum = ylinestart; for (x = ystart_x_sc; x < buf->rect.x1; x += spacing_ylines, ylinenum++) { - gint const x0 = (gint) Inkscape::round(x); + gint const x0 = round(x); if (!scaled && (ylinenum % empspacing) != 0) { sp_grid_vline (buf, x0, buf->rect.y0, buf->rect.y1 - 1, color); @@ -597,13 +598,13 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) // z-axis always goes from bottomleft to topright. (0,1) - (1,0) gdouble const zintercept_y_bc = (buf_tl_gc[Geom::X] * -tan_angle[Z]) - buf_tl_gc[Geom::Y] ; gdouble const zstart_y_sc = ( zintercept_y_bc - floor(zintercept_y_bc/lyw)*lyw ) + buf->rect.y0; - gint const zlinestart = (gint) Inkscape::round( (zstart_y_sc + buf->rect.x0*tan_angle[Z] - ow[Geom::Y]) / lyw ); + gint const zlinestart = round( (zstart_y_sc + buf->rect.x0*tan_angle[Z] - ow[Geom::Y]) / lyw ); gint zlinenum = zlinestart; // lines starting from left side for (y = zstart_y_sc; y < buf->rect.y1; y += lyw, zlinenum++) { gint const x0 = buf->rect.x0; - gint const y0 = (gint) Inkscape::round(y); - gint const x1 = x0 + (gint) Inkscape::round( (y - buf->rect.y0 ) / tan_angle[Z] ); + gint const y0 = round(y); + gint const x1 = x0 + round( (y - buf->rect.y0 ) / tan_angle[Z] ); gint const y1 = buf->rect.y0; if (!scaled && (zlinenum % empspacing) != 0) { @@ -617,8 +618,8 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) for (x = zstart_x_sc; x < buf->rect.x1; x += lxw_z, zlinenum++) { gint const y0 = buf->rect.y1; gint const y1 = buf->rect.y0; - gint const x0 = (gint) Inkscape::round(x); - gint const x1 = x0 + (gint) Inkscape::round( (buf->rect.y1 - buf->rect.y0) / tan_angle[Z] ); + gint const x0 = round(x); + gint const x1 = x0 + round( (buf->rect.y1 - buf->rect.y0) / tan_angle[Z] ); if (!scaled && (zlinenum % empspacing) != 0) { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); |
