simplify RawIter - don't return a pt in kClose

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1156893003
This commit is contained in:
reed 2015-05-27 19:53:25 -07:00 committed by Commit bot
parent 6fd158ea47
commit 6e43465039
3 changed files with 4 additions and 12 deletions

View File

@ -917,7 +917,6 @@ public:
const uint8_t* fVerbs;
const uint8_t* fVerbStop;
const SkScalar* fConicWeights;
SkPoint fMoveTo;
};
/**

View File

@ -1777,7 +1777,6 @@ SkPath::RawIter::RawIter() {
#ifdef SK_DEBUG
fPts = NULL;
fConicWeights = NULL;
fMoveTo.fX = fMoveTo.fY = 0;
#endif
// need to init enough to make next() harmlessly return kDone_Verb
fVerbs = NULL;
@ -1793,7 +1792,6 @@ void SkPath::RawIter::setPath(const SkPath& path) {
fVerbs = path.fPathRef->verbs();
fVerbStop = path.fPathRef->verbsMemBegin();
fConicWeights = path.fPathRef->conicWeights() - 1; // begin one behind
fMoveTo.fX = fMoveTo.fY = 0;
}
SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) {
@ -1808,7 +1806,7 @@ SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) {
switch (verb) {
case kMove_Verb:
fMoveTo = pts[0] = srcPts[0];
pts[0] = srcPts[0];
srcPts += 1;
break;
case kLine_Verb:
@ -1833,7 +1831,9 @@ SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) {
srcPts += 3;
break;
case kClose_Verb:
pts[0] = fMoveTo;
break;
case kDone_Verb:
SkASSERT(fVerbs == fVerbStop);
break;
}
fPts = srcPts;

View File

@ -2602,14 +2602,10 @@ static void test_raw_iter(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1);
REPORTER_ASSERT(reporter, pts[0].fY == 0);
REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb);
REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1);
REPORTER_ASSERT(reporter, pts[0].fY == 0);
REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb);
REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*2);
REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1);
REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb);
REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*2);
REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1);
REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb);
REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*3);
REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*2);
@ -2617,8 +2613,6 @@ static void test_raw_iter(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*4);
REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*3);
REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb);
REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*4);
REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*3);
REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kDone_Verb);
// Generate random paths and verify
@ -2761,7 +2755,6 @@ static void test_raw_iter(skiatest::Reporter* reporter) {
numIterPts += 3;
break;
case SkPath::kClose_Verb:
REPORTER_ASSERT(reporter, pts[0] == lastMoveTo);
lastPt = lastMoveTo;
break;
default: