diff options
author | 2011-12-29 21:03:28 +0000 | |
---|---|---|
committer | 2011-12-29 21:03:28 +0000 | |
commit | 72785c4c8928a8b0fc5bbdb48929f9356554dace (patch) | |
tree | f7eec460a9d6a4c52e78fc2571329a3068ae39c4 /src/core/SkPath.cpp | |
parent | a31ac73b8e261f02c4bd6ae1d622c4bd00226b80 (diff) |
Fix problems with SampleApp Fuzzer due to issues in iterating over degenerate paths.
The fuzzer gets my vote as best test tool ever.
There are several issues outstanding: crashes in FixedPoint and a crash in the
path filling code that is most likely due to clipping problems (but maybe not).
BUG=425
Review URL: http://codereview.appspot.com/5503080
git-svn-id: http://skia.googlecode.com/svn/trunk@2936 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPath.cpp')
-rw-r--r-- | src/core/SkPath.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 7e6ac8c222..22860bf616 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -1185,9 +1185,10 @@ void SkPath::Iter::setPath(const SkPath& path, bool forceClose) { fVerbs = path.fVerbs.begin(); fVerbStop = path.fVerbs.end(); fLastPt.fX = fLastPt.fY = 0; + fMoveTo.fX = fMoveTo.fY = 0; fForceClose = SkToU8(forceClose); fNeedClose = false; - fSegmentState = kAfterPrimitive_SegmentState; + fSegmentState = kAfterClose_SegmentState; } bool SkPath::Iter::isClosedContour() const { @@ -1279,10 +1280,6 @@ void SkPath::Iter::consumeDegenerateSegments() { unsigned verb = *fVerbs; switch (verb) { case kMove_Verb: - // Set state for the next method. - fSegmentState = kAfterMove_SegmentState; - fMoveTo = fPts[0]; - // Keep a record of this most recent move lastMoveVerb = fVerbs; lastMovePt = fPts; @@ -1385,16 +1382,13 @@ SkPath::Verb SkPath::Iter::next(SkPoint pts[4]) { if (fVerbs == fVerbStop) { // might be a trailing moveto return kDone_Verb; } -#ifdef SK_OLD_EMPTY_PATH_BEHAVIOR fMoveTo = *srcPts; -#endif if (pts) { pts[0] = *srcPts; } srcPts += 1; -#ifdef SK_OLD_EMPTY_PATH_BEHAVIOR fSegmentState = kAfterMove_SegmentState; -#else +#ifndef SK_OLD_EMPTY_PATH_BEHAVIOR fLastPt = fMoveTo; #endif fNeedClose = fForceClose; |