aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-03-20 12:16:09 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-03-20 12:16:09 +0000
commit4ddfe357da4a94f587b6ca18b398c23478fa1b24 (patch)
tree1163520d6f8f12152052b408bb34f8a1b7f0be5d /src
parent797d51acd265fbadd1b54b0974fbb70b8c3d06eb (diff)
check for NaN in path iterator (otherwise we have an infinite loop)
git-svn-id: http://skia.googlecode.com/svn/trunk@131 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPath.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 3d5ccda786..97b366d689 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -989,6 +989,14 @@ bool SkPath::Iter::isClosedContour() const {
SkPath::Verb SkPath::Iter::autoClose(SkPoint pts[2]) {
if (fLastPt != fMoveTo) {
+ // 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)) {
+ return kClose_Verb;
+ }
+
if (pts) {
pts[0] = fLastPt;
pts[1] = fMoveTo;