From: <md...@us...> - 2008-04-24 12:54:30
|
Revision: 5070 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5070&view=rev Author: mdboom Date: 2008-04-24 05:54:25 -0700 (Thu, 24 Apr 2008) Log Message: ----------- Fix compilation issues on VS2003. (Thanks Martin Spacek) Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/agg_py_path_iterator.h trunk/matplotlib/src/mplutils.h Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-24 12:34:47 UTC (rev 5069) +++ trunk/matplotlib/CHANGELOG 2008-04-24 12:54:25 UTC (rev 5070) @@ -1,3 +1,6 @@ +2008-04-24 Fix compilation issues on VS2003 (Thanks Martin Spacek for + all the help) - MGD + 2008-04-24 Fix sub/superscripts when the size of the font has been changed - MGD Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-04-24 12:34:47 UTC (rev 5069) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-04-24 12:54:25 UTC (rev 5070) @@ -270,8 +270,8 @@ double l, b, r, t; if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) { - rasterizer->clip_box(int(round(l)) + 1, height - int(round(b)), - int(round(r)), height - int(round(t))); + rasterizer->clip_box(int(mpl_round(l)) + 1, height - int(mpl_round(b)), + int(mpl_round(r)), height - int(mpl_round(t))); } _VERBOSE("RendererAgg::set_clipbox done"); @@ -807,7 +807,7 @@ if (gc.linewidth != 0.0) { double linewidth = gc.linewidth; if (!gc.isaa) { - linewidth = (linewidth < 0.5) ? 0.5 : round(linewidth); + linewidth = (linewidth < 0.5) ? 0.5 : mpl_round(linewidth); } if (gc.dashes.size() == 0) { stroke_t stroke(path); @@ -1576,7 +1576,7 @@ int newwidth = 0; int newheight = 0; Py::String data; - if (xmin < xmax and ymin < ymax) { + if (xmin < xmax && ymin < ymax) { // Expand the bounds by 1 pixel on all sides xmin = std::max(0, xmin - 1); ymin = std::max(0, ymin - 1); Modified: trunk/matplotlib/src/agg_py_path_iterator.h =================================================================== --- trunk/matplotlib/src/agg_py_path_iterator.h 2008-04-24 12:34:47 UTC (rev 5069) +++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-04-24 12:54:25 UTC (rev 5070) @@ -6,12 +6,9 @@ #include "numpy/arrayobject.h" #include "agg_path_storage.h" #include "MPL_isnan.h" +#include "mplutils.h" #include <queue> -static inline double my_round(double v) { - return (double)(int)(v + ((v >= 0.0) ? 0.5 : -0.5)); -} - class PathIterator { PyArrayObject* m_vertices; @@ -161,8 +158,8 @@ cmd = m_source->vertex(x, y); if (m_quantize && agg::is_vertex(cmd)) { - *x = my_round(*x) + 0.5; - *y = my_round(*y) + 0.5; + *x = mpl_round(*x) + 0.5; + *y = mpl_round(*y) + 0.5; } return cmd; } @@ -218,8 +215,8 @@ // Do any quantization if requested if (m_quantize && agg::is_vertex(cmd)) { - *x = my_round(*x) + 0.5; - *y = my_round(*y) + 0.5; + *x = mpl_round(*x) + 0.5; + *y = mpl_round(*y) + 0.5; } //if we are starting a new path segment, move to the first point Modified: trunk/matplotlib/src/mplutils.h =================================================================== --- trunk/matplotlib/src/mplutils.h 2008-04-24 12:34:47 UTC (rev 5069) +++ trunk/matplotlib/src/mplutils.h 2008-04-24 12:54:25 UTC (rev 5070) @@ -1,4 +1,4 @@ -/* mplutils.h -- +/* mplutils.h -- * * $Header$ * $Log$ @@ -26,6 +26,10 @@ #undef MAX #define MAX(a, b) (((a) > (b)) ? (a) : (b)) +inline double mpl_round(double v) { + return (double)(int)(v + ((v >= 0.0) ? 0.5 : -0.5)); +} + class Printf { private : This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |