Merge pull request #3930 from mlampert/bugfix/voronoi-32-bit-build-failure

PATH: Dealing with 32bit compile error of Voronoi interface.
This commit is contained in:
sliptonic
2020-10-05 14:21:01 -05:00
committed by GitHub
4 changed files with 15 additions and 5 deletions

View File

@@ -34,6 +34,12 @@
#include <boost/polygon/segment_concept.hpp>
#include <boost/polygon/voronoi.hpp>
#if (SIZE_MAX == UINT_MAX)
# define PATH_VORONOI_COLOR_MASK 0x07FFFFFFul
#else
# define PATH_VORONOI_COLOR_MASK 0x07FFFFFFFFFFFFFFul
#endif
namespace Path
{
class PathExport Voronoi
@@ -48,7 +54,7 @@ namespace Path
typedef std::size_t color_type;
static const int InvalidIndex = INT_MAX;
static const color_type ColorMask = 0x07FFFFFFFFFFFFFFul; // top 5 bits reserved internally
static const color_type ColorMask = PATH_VORONOI_COLOR_MASK;
// types
typedef double coordinate_type;

View File

@@ -122,7 +122,8 @@ Py::Long VoronoiCellPy::getIndex(void) const {
Py::Long VoronoiCellPy::getColor(void) const {
VoronoiCell *c = getVoronoiCellPtr();
if (c->isBound()) {
return Py::Long(c->ptr->color() & Voronoi::ColorMask);
Voronoi::color_type color = c->ptr->color() & Voronoi::ColorMask;
return Py::Long(color);
}
return Py::Long(0);
}
@@ -134,7 +135,8 @@ void VoronoiCellPy::setColor(Py::Long color) {
Py::Long VoronoiCellPy::getSourceIndex(void) const
{
VoronoiCell *c = getVoronoiCellFromPy(this);
return Py::Long(c->ptr->source_index());
long index = c->ptr->source_index();
return Py::Long(index);
}
Py::Int VoronoiCellPy::getSourceCategory(void) const

View File

@@ -141,7 +141,8 @@ Py::Long VoronoiEdgePy::getIndex(void) const {
Py::Long VoronoiEdgePy::getColor(void) const {
VoronoiEdge *e = getVoronoiEdgePtr();
if (e->isBound()) {
return Py::Long(e->ptr->color() & Voronoi::ColorMask);
Voronoi::color_type color = e->ptr->color() & Voronoi::ColorMask;
return Py::Long(color);
}
return Py::Long(0);
}

View File

@@ -124,7 +124,8 @@ Py::Long VoronoiVertexPy::getIndex(void) const {
Py::Long VoronoiVertexPy::getColor(void) const {
VoronoiVertex *v = getVoronoiVertexPtr();
if (v->isBound()) {
return Py::Long(v->ptr->color() & Voronoi::ColorMask);
Voronoi::color_type color = v->ptr->color() & Voronoi::ColorMask;
return Py::Long(color);
}
return Py::Long(0);
}