Skip to content

Commit 048668b

Browse files
committed
Use our own "round" function, since it doesn't appear to exist in VS2003
svn path=/trunk/matplotlib/; revision=5064
1 parent fffc519 commit 048668b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/agg_py_path_iterator.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#include "MPL_isnan.h"
99
#include <queue>
1010

11+
static inline double my_round(double v) {
12+
return (double)(int)(v + ((v >= 0.0) ? 0.5 : -0.5));
13+
}
14+
1115
class PathIterator
1216
{
1317
PyArrayObject* m_vertices;
@@ -157,8 +161,8 @@ class SimplifyPath
157161
cmd = m_source->vertex(x, y);
158162
if (m_quantize && agg::is_vertex(cmd))
159163
{
160-
*x = round(*x) + 0.5;
161-
*y = round(*y) + 0.5;
164+
*x = my_round(*x) + 0.5;
165+
*y = my_round(*y) + 0.5;
162166
}
163167
return cmd;
164168
}
@@ -214,8 +218,8 @@ class SimplifyPath
214218
// Do any quantization if requested
215219
if (m_quantize && agg::is_vertex(cmd))
216220
{
217-
*x = round(*x) + 0.5;
218-
*y = round(*y) + 0.5;
221+
*x = my_round(*x) + 0.5;
222+
*y = my_round(*y) + 0.5;
219223
}
220224

221225
//if we are starting a new path segment, move to the first point

0 commit comments

Comments
 (0)