From fca0aa676e5288d2b867f24263059233253510b5 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Wed, 12 Oct 2016 16:56:20 +0300 Subject: [PATCH] QPathClipper: remove homebrew 'qRemoveDuplicates' algorithm Use std::unique Change-Id: Iae2e80d16b5a443ee5023224f48c325197c23029 Reviewed-by: Marc Mutz Reviewed-by: Edward Welbourne --- src/gui/painting/qpathclipper.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index f92a681eca..addd9c0c2c 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -1458,25 +1458,6 @@ QPathClipper::QPathClipper(const QPainterPath &subject, bMask = clipPath.fillRule() == Qt::WindingFill ? ~0x0 : 0x1; } -template -Iterator qRemoveDuplicates(Iterator begin, Iterator end, Equality eq) -{ - if (begin == end) - return end; - - Iterator last = begin; - ++begin; - Iterator insert = begin; - for (Iterator it = begin; it != end; ++it) { - if (!eq(*it, *last)) { - *insert++ = *it; - last = it; - } - } - - return insert; -} - static void clear(QWingedEdge& list, int edge, QPathEdge::Traversal traversal) { QWingedEdge::TraversalStatus status; @@ -1643,7 +1624,7 @@ bool QPathClipper::doClip(QWingedEdge &list, ClipperMode mode) y_coords << list.vertex(i)->y; std::sort(y_coords.begin(), y_coords.end()); - y_coords.resize(qRemoveDuplicates(y_coords.begin(), y_coords.end(), fuzzyCompare) - y_coords.begin()); + y_coords.erase(std::unique(y_coords.begin(), y_coords.end(), fuzzyCompare), y_coords.end()); #ifdef QDEBUG_CLIPPER printf("sorted y coords:\n");