fall through to cross-product if the y-max-baseline returns a degenerate line
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 31 Jan 2012 15:25:22 +0000 (15:25 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 31 Jan 2012 15:25:22 +0000 (15:25 +0000)
(i.e. maxIndex == minIndex)

git-svn-id: http://skia.googlecode.com/svn/trunk@3119 2bbb7eff-a529-9590-31e7-b0007b416f81

src/core/SkPath.cpp

index 08fdb9d..72a7d68 100644 (file)
@@ -2023,7 +2023,9 @@ bool SkPath::cheapComputeDirection(Direction* dir) const {
             if (pts[(index + 1) % n].fY == pts[index].fY) {
                 int maxIndex;
                 int minIndex = find_min_max_x_at_y(pts, index, n, &maxIndex);
-                // minIndex might == maxIndex, but that should be fine.
+                if (minIndex == maxIndex) {
+                    goto TRY_CROSSPROD;
+                }
                 SkASSERT(pts[minIndex].fY == pts[index].fY);
                 SkASSERT(pts[maxIndex].fY == pts[index].fY);
                 SkASSERT(pts[minIndex].fX <= pts[maxIndex].fX);
@@ -2031,6 +2033,7 @@ bool SkPath::cheapComputeDirection(Direction* dir) const {
                 // SkScalar, since we just want - or + to signal the direction.
                 cross = minIndex - maxIndex;
             } else {
+                TRY_CROSSPROD:
                 // Find a next and prev index to use for the cross-product test,
                 // but we try to find pts that form non-zero vectors from pts[index]
                 //