diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-07 17:47:33 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-07 17:47:33 +0000 |
commit | f6d3c5aa5f93e4c3cc7a7aebf014e960cf837783 (patch) | |
tree | d5d190e6b17489740e3ff5a393bec6cce904cd0e | |
parent | 5867c0f03262a3ce11c6790d5bd75ce0ebcb197c (diff) |
Make SkPath::RawIter require a non-NULL pts pointer.
Review URL: http://codereview.appspot.com/6301060/
git-svn-id: http://skia.googlecode.com/svn/trunk@4206 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | include/core/SkPath.h | 1 | ||||
-rw-r--r-- | src/core/SkPath.cpp | 27 |
2 files changed, 10 insertions, 18 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h index e5093462f8..4e987c0a20 100644 --- a/include/core/SkPath.h +++ b/include/core/SkPath.h @@ -753,6 +753,7 @@ public: segments have been visited, return kDone_Verb. @param pts The points representing the current verb and/or segment + This must not be NULL. @return The verb for the current segment */ Verb next(SkPoint pts[4]); diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index a9693c2f67..34b0ac9360 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -1632,6 +1632,7 @@ void SkPath::RawIter::setPath(const SkPath& path) { } SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) { + SkASSERT(NULL != pts); if (fVerbs == fVerbStop) { return kDone_Verb; } @@ -1641,42 +1642,32 @@ SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) { switch (verb) { case kMove_Verb: - if (pts) { - pts[0] = *srcPts; - } + pts[0] = *srcPts; fMoveTo = srcPts[0]; fLastPt = fMoveTo; srcPts += 1; break; case kLine_Verb: - if (pts) { - pts[0] = fLastPt; - pts[1] = srcPts[0]; - } + pts[0] = fLastPt; + pts[1] = srcPts[0]; fLastPt = srcPts[0]; srcPts += 1; break; case kQuad_Verb: - if (pts) { - pts[0] = fLastPt; - memcpy(&pts[1], srcPts, 2 * sizeof(SkPoint)); - } + pts[0] = fLastPt; + memcpy(&pts[1], srcPts, 2 * sizeof(SkPoint)); fLastPt = srcPts[1]; srcPts += 2; break; case kCubic_Verb: - if (pts) { - pts[0] = fLastPt; - memcpy(&pts[1], srcPts, 3 * sizeof(SkPoint)); - } + pts[0] = fLastPt; + memcpy(&pts[1], srcPts, 3 * sizeof(SkPoint)); fLastPt = srcPts[2]; srcPts += 3; break; case kClose_Verb: fLastPt = fMoveTo; - if (pts) { - pts[0] = fMoveTo; - } + pts[0] = fMoveTo; break; } fPts = srcPts; |