diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-26 14:45:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-27 10:25:09 +0100 |
commit | b7e08c594066e626a92a460931d93b7f64c16df6 (patch) | |
tree | c1de3bd79c860cd0879caa50ca7e9699b756fc83 /basegfx | |
parent | 68e6706fb931ed2f53c08bc9c0a02cbb559c8c53 (diff) |
loplugin:useuniqueptr in Triangulator
Change-Id: If963704ec8af82ed2af1418621ef7fc5e475567f
Reviewed-on: https://gerrit.libreoffice.org/50364
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/polygon/b2dpolygontriangulator.cxx | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx index a2c740f91798..ab97419144d4 100644 --- a/basegfx/source/polygon/b2dpolygontriangulator.cxx +++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx @@ -104,13 +104,12 @@ namespace basegfx }; typedef std::vector< EdgeEntry > EdgeEntries; - typedef std::vector< EdgeEntry* > EdgeEntryPointers; class Triangulator { EdgeEntry* mpList; EdgeEntries maStartEntries; - EdgeEntryPointers maNewEdgeEntries; + std::vector< std::unique_ptr<EdgeEntry> > maNewEdgeEntries; B2DPolygon maResult; void handleClosingEdge(const B2DPoint& rStart, const B2DPoint& rEnd); @@ -119,7 +118,6 @@ namespace basegfx public: explicit Triangulator(const B2DPolyPolygon& rCandidate); - ~Triangulator(); const B2DPolygon& getResult() const { return maResult; } }; @@ -155,7 +153,7 @@ namespace basegfx { // insert closing edge EdgeEntry* pNew = new EdgeEntry(aNew); - maNewEdgeEntries.push_back(pNew); + maNewEdgeEntries.emplace_back(pNew); pCurr = mpList; pPrev = nullptr; @@ -189,8 +187,8 @@ namespace basegfx // found point in triangle -> split triangle inserting two edges EdgeEntry* pStart = new EdgeEntry(pEdgeA->getStart(), rTestPoint); EdgeEntry* pEnd = new EdgeEntry(*pStart); - maNewEdgeEntries.push_back(pStart); - maNewEdgeEntries.push_back(pEnd); + maNewEdgeEntries.emplace_back(pStart); + maNewEdgeEntries.emplace_back(pEnd); pStart->setNext(pEnd); pEnd->setNext(pEdgeA->getNext()); @@ -365,14 +363,6 @@ namespace basegfx } } - Triangulator::~Triangulator() - { - for (auto const& newEdgeEntry : maNewEdgeEntries) - { - delete newEdgeEntry; - } - } - } // end of anonymous namespace } // end of namespace basegfx |