aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkRegion.h6
-rw-r--r--src/core/SkRegion_path.cpp7
2 files changed, 9 insertions, 4 deletions
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h
index bbce882af6..9d89d94188 100644
--- a/include/core/SkRegion.h
+++ b/include/core/SkRegion.h
@@ -86,9 +86,9 @@ public:
const SkIRect& getBounds() const { return fBounds; }
/**
- * Returns true if the region is non-empty, and if so, sets the specified
- * path to the boundary(s) of the region. If the region is empty, then
- * this returns false, and path is left unmodified.
+ * Returns true if the region is non-empty, and if so, appends the
+ * boundary(s) of the region to the specified path.
+ * If the region is empty, returns false, and path is left unmodified.
*/
bool getBoundaryPath(SkPath* path) const;
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp
index 9521206703..345ecf8b8a 100644
--- a/src/core/SkRegion_path.cpp
+++ b/src/core/SkRegion_path.cpp
@@ -422,6 +422,10 @@ static int EdgeProc(const Edge* a, const Edge* b) {
}
bool SkRegion::getBoundaryPath(SkPath* path) const {
+ // path could safely be NULL if we're empty, but the caller shouldn't
+ // *know* that
+ SkASSERT(path);
+
if (this->isEmpty()) {
return false;
}
@@ -443,7 +447,8 @@ bool SkRegion::getBoundaryPath(SkPath* path) const {
edge[0].set(r.fLeft, r.fBottom, r.fTop);
edge[1].set(r.fRight, r.fTop, r.fBottom);
}
- SkQSort(edges.begin(), edges.count(), sizeof(Edge), (SkQSortCompareProc)EdgeProc);
+ SkQSort(edges.begin(), edges.count(), sizeof(Edge),
+ (SkQSortCompareProc)EdgeProc);
int count = edges.count();
Edge* start = edges.begin();