change getLastPt to return a bool

git-svn-id: http://skia.googlecode.com/svn/trunk@2453 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-10-11 11:58:32 +00:00
parent 5e2457ef2e
commit 294dd7b3d7
2 changed files with 12 additions and 8 deletions

View File

@ -546,11 +546,12 @@ public:
}
/** Return the last point on the path. If no points have been added, (0,0)
is returned.
is returned. If there are no points, this returns false, otherwise it
returns true.
@param lastPt The last point on the path is returned here
*/
void getLastPt(SkPoint* lastPt) const;
bool getLastPt(SkPoint* lastPt) const;
/** Set the last point on the path. If no points have been added,
moveTo(x,y) is automatically called.

View File

@ -327,17 +327,20 @@ SkPoint SkPath::getPoint(int index) const {
return SkPoint::Make(0, 0);
}
void SkPath::getLastPt(SkPoint* lastPt) const {
bool SkPath::getLastPt(SkPoint* lastPt) const {
SkDEBUGCODE(this->validate();)
if (lastPt) {
int count = fPts.count();
if (count == 0) {
lastPt->set(0, 0);
} else {
int count = fPts.count();
if (count > 0) {
if (lastPt) {
*lastPt = fPts[count - 1];
}
return true;
}
if (lastPt) {
lastPt->set(0, 0);
}
return false;
}
void SkPath::setLastPt(SkScalar x, SkScalar y) {