fix NaN in path iterator

fix case where cubic is big/degenerate, and never returns a valid edge



git-svn-id: http://skia.googlecode.com/svn/trunk@280 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-07-22 17:06:15 +00:00
parent f03642675e
commit 9da1ae3f35
3 changed files with 6 additions and 6 deletions

View File

@ -419,8 +419,9 @@ int SkCubicEdge::setCubic(const SkPoint pts[4], const SkIRect* clip, int shift)
if (clip)
{
do {
for (;!this->updateCubic();)
;
if (!this->updateCubic()) {
return 0;
}
} while (!this->intersectsClip(*clip));
this->chopLineWithClip(*clip);
return 1;

View File

@ -986,8 +986,8 @@ SkPath::Verb SkPath::Iter::autoClose(SkPoint pts[2]) {
// A special case: if both points are NaN, SkPoint::operation== returns
// false, but the iterator expects that they are treated as the same.
// (consider SkPoint is a 2-dimension float point).
if (SkScalarIsNaN(fLastPt.fX) && SkScalarIsNaN(fLastPt.fY) &&
SkScalarIsNaN(fMoveTo.fX) && SkScalarIsNaN(fMoveTo.fY)) {
if (SkScalarIsNaN(fLastPt.fX) || SkScalarIsNaN(fLastPt.fY) ||
SkScalarIsNaN(fMoveTo.fX) || SkScalarIsNaN(fMoveTo.fY)) {
return kClose_Verb;
}

View File

@ -479,10 +479,9 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
SkEdge headEdge, tailEdge, *last;
SkASSERT(count <= maxCount);
if (count == 0) {
if (count < 2) {
return;
}
SkASSERT(count > 1);
// this returns the first and last edge after they're sorted into a dlink list
edge = sort_edges(list, count, &last);