Reworked the ClipperLib / Polygon types to use

the tbb::scallable_allocator to better scale on multiple threads.
This commit is contained in:
Vojtech Bubnik 2023-04-20 11:31:44 +02:00
parent b0cc0e98fa
commit 9cde96993e
38 changed files with 261 additions and 241 deletions

View file

@ -784,7 +784,7 @@ bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
return false;
// Allocate a new edge array.
std::vector<TEdge> edges(highI + 1);
Edges edges(highI + 1);
// Fill in the edge array.
bool result = AddPathInternal(pg, highI, PolyTyp, Closed, edges.data());
if (result)
@ -1079,7 +1079,7 @@ Clipper::Clipper(int initOptions) :
void Clipper::Reset()
{
ClipperBase::Reset();
m_Scanbeam = std::priority_queue<cInt>();
m_Scanbeam = std::priority_queue<cInt, cInts>{};
m_Maxima.clear();
m_ActiveEdges = 0;
m_SortedEdges = 0;
@ -2226,8 +2226,8 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
if (!eLastHorz->NextInLML)
eMaxPair = GetMaximaPair(eLastHorz);
std::vector<cInt>::const_iterator maxIt;
std::vector<cInt>::const_reverse_iterator maxRit;
cInts::const_iterator maxIt;
cInts::const_reverse_iterator maxRit;
if (!m_Maxima.empty())
{
//get the first maxima in range (X) ...
@ -3941,7 +3941,7 @@ void CleanPolygon(const Path& in_poly, Path& out_poly, double distance)
return;
}
std::vector<OutPt> outPts(size);
OutPts outPts(size);
for (size_t i = 0; i < size; ++i)
{
outPts[i].Pt = in_poly[i];