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

Unified Diff: src/core/SkRegion_path.cpp

Issue 1313203003: Remove include of stdlib.h from SkTypes.h. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up qsort conversion. Created 5 years, 4 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/core/SkGraphics.cpp ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRegion_path.cpp
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp
index ad01cacfba63b3009051964c89969e3ae18f6432..b07d679aa1375d26238e245b85b6e44acc43a747 100644
--- a/src/core/SkRegion_path.cpp
+++ b/src/core/SkRegion_path.cpp
@@ -8,6 +8,7 @@
#include "SkRegionPriv.h"
#include "SkBlitter.h"
#include "SkScan.h"
+#include "SkTSort.h"
#include "SkTDArray.h"
#include "SkPath.h"
@@ -476,11 +477,11 @@ static int extract_path(Edge* edge, Edge* stop, SkPath* path) {
return count;
}
-#include "SkTSearch.h"
-
-static int EdgeProc(const Edge* a, const Edge* b) {
- return (a->fX == b->fX) ? a->top() - b->top() : a->fX - b->fX;
-}
+struct EdgeLT {
+ bool operator()(const Edge& a, const Edge& b) const {
+ return (a.fX == b.fX) ? a.top() < b.top() : a.fX < b.fX;
+ }
+};
bool SkRegion::getBoundaryPath(SkPath* path) const {
// path could safely be NULL if we're empty, but the caller shouldn't
@@ -508,13 +509,13 @@ bool SkRegion::getBoundaryPath(SkPath* path) const {
edge[0].set(r.fLeft, r.fBottom, r.fTop);
edge[1].set(r.fRight, r.fTop, r.fBottom);
}
- qsort(edges.begin(), edges.count(), sizeof(Edge), SkCastForQSort(EdgeProc));
int count = edges.count();
Edge* start = edges.begin();
Edge* stop = start + count;
- Edge* e;
+ SkTQSort<Edge>(start, stop - 1, EdgeLT());
+ Edge* e;
for (e = start; e != stop; e++) {
find_link(e, stop);
}
« no previous file with comments | « src/core/SkGraphics.cpp ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698