Update header comments to more accurately describe behavior of
SkRegion::getBoundaryPath(). Add SkASSERT of SkPath argument for safety. codereview.appspot.com/5504095/ git-svn-id: http://skia.googlecode.com/svn/trunk@2942 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
1a366217cd
commit
d5d9dadcdd
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user