Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1746)

Unified Diff: src/pathops/SkPathOpsCommon.cpp

Issue 14034014: path ops -- use standard SkTQSort (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkOpContour.cpp ('k') | src/pathops/TSearch.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsCommon.cpp
===================================================================
--- src/pathops/SkPathOpsCommon.cpp (revision 8745)
+++ src/pathops/SkPathOpsCommon.cpp (working copy)
@@ -7,7 +7,7 @@
#include "SkOpEdgeBuilder.h"
#include "SkPathOpsCommon.h"
#include "SkPathWriter.h"
-#include "TSearch.h"
+#include "SkTSort.h"
static int contourRangeCheckY(const SkTDArray<SkOpContour*>& contourList, SkOpSegment** currentPtr,
int* indexPtr, int* endIndexPtr, double* bestHit, SkScalar* bestDx,
@@ -370,16 +370,22 @@
contour.setOppXor(contour.operand() ? evenOdd : oppEvenOdd);
*list.append() = &contour;
}
- QSort<SkOpContour>(list.begin(), list.end() - 1);
+ SkTQSort<SkOpContour>(list.begin(), list.end() - 1);
}
static bool approximatelyEqual(const SkPoint& a, const SkPoint& b) {
return AlmostEqualUlps(a.fX, b.fX) && AlmostEqualUlps(a.fY, b.fY);
}
-static bool lessThan(SkTDArray<double>& distances, const int one, const int two) {
- return distances[one] < distances[two];
-}
+class DistanceLessThan {
+public:
+ DistanceLessThan(double* distances) : fDistances(distances) { }
+ double* fDistances;
bungeman-skia 2013/04/22 16:00:44 It probably makes no difference whatsoever, but fD
+ bool operator()(const int one, const int two) {
bungeman-skia 2013/04/22 16:00:44 Again, somewhat silly, but this operator can be ma
+ return fDistances[one] < fDistances[two];
+ }
+};
+
/*
check start and end of each contour
if not the same, record them
@@ -453,7 +459,7 @@
for (rIndex = 0; rIndex < entries; ++rIndex) {
sortedDist[rIndex] = rIndex;
}
- QSort<SkTDArray<double>, int>(distances, sortedDist.begin(), sortedDist.end() - 1, lessThan);
+ SkTQSort<int>(sortedDist.begin(), sortedDist.end() - 1, DistanceLessThan(distances.begin()));
int remaining = count; // number of start/end pairs
for (rIndex = 0; rIndex < entries; ++rIndex) {
int pair = sortedDist[rIndex];
« no previous file with comments | « src/pathops/SkOpContour.cpp ('k') | src/pathops/TSearch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698