Add SkPath::getVerbs/countVerbs
Review URL: http://codereview.appspot.com/6306053/
git-svn-id: http://skia.googlecode.com/svn/trunk@4209 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 34b0ac9..4dab604 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -390,14 +390,13 @@
return result;
}
-int SkPath::getPoints(SkPoint copy[], int max) const {
+int SkPath::getPoints(SkPoint dst[], int max) const {
SkDEBUGCODE(this->validate();)
SkASSERT(max >= 0);
+ SkASSERT(!max || dst);
int count = fPts.count();
- if (copy && max > 0 && count > 0) {
- memcpy(copy, fPts.begin(), sizeof(SkPoint) * SkMin32(max, count));
- }
+ fPts.copyRange(dst, 0, max);
return count;
}
@@ -408,6 +407,15 @@
return SkPoint::Make(0, 0);
}
+int SkPath::getVerbs(uint8_t dst[], int max) const {
+ SkDEBUGCODE(this->validate();)
+
+ SkASSERT(max >= 0);
+ SkASSERT(!max || dst);
+ fVerbs.copyRange(dst, 0, max);
+ return fVerbs.count();
+}
+
bool SkPath::getLastPt(SkPoint* lastPt) const {
SkDEBUGCODE(this->validate();)