add countPoints() and getPoint()

git-svn-id: http://skia.googlecode.com/svn/trunk@494 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2010-02-09 16:38:45 +00:00
Родитель 218521e157
Коммит d3aa4ff7a5
2 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -123,6 +123,18 @@ public:
*/ */
bool isRect(SkRect* rect) const; bool isRect(SkRect* rect) const;
/** Return the number of points in the path
*/
int countPoints() const {
return this->getPoints(NULL, 0);
}
/** Return the point at the specified index. If the index is out of range
(i.e. is not 0 <= index < countPoints()) then the returned coordinates
will be (0,0)
*/
SkPoint getPoint(int index) const;
/** Returns the number of points in the path. Up to max points are copied. /** Returns the number of points in the path. Up to max points are copied.
@param points If not null, receives up to max points @param points If not null, receives up to max points

Просмотреть файл

@ -184,6 +184,13 @@ int SkPath::getPoints(SkPoint copy[], int max) const {
return count; return count;
} }
SkPoint SkPath::getPoint(int index) const {
if ((unsigned)index < (unsigned)fPts.count()) {
return fPts[index];
}
return SkPoint::Make(0, 0);
}
void SkPath::getLastPt(SkPoint* lastPt) const { void SkPath::getLastPt(SkPoint* lastPt) const {
SkDEBUGCODE(this->validate();) SkDEBUGCODE(this->validate();)