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
This commit is contained in:
schenney@chromium.org 2011-12-29 21:03:28 +00:00
Родитель a31ac73b8e
Коммит 72785c4c89
2 изменённых файлов: 11 добавлений и 11 удалений

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

@ -623,11 +623,17 @@ public:
/** Iterate through all of the segments (lines, quadratics, cubics) of
each contours in a path.
The iterator cleans up the segments along the way, removing degenerate
segments and adding close verbs where necessary. When the forceClose
argument is provided, each contour (as defined by a new starting
move command) will be completed with a close verb regardless of the
contour's contents.
*/
class SK_API Iter {
public:
Iter();
Iter(const SkPath&, bool forceClose);
Iter();
Iter(const SkPath&, bool forceClose);
void setPath(const SkPath&, bool forceClose);

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

@ -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;