diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-23 12:04:05 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-23 12:04:05 +0000 |
commit | c3f63570c35a1e2bc84b33906c6401d6f3062bf2 (patch) | |
tree | 37b59309f586a8573e031b03b74220049dd1c0bd /src/pathops/SkDLineIntersection.cpp | |
parent | 3b97af5add04489d57c7926ba6dc6f0013daf40f (diff) |
path ops : enable optimizations
this addresses a few FIXME issues
- speed up implicit quad computation
- use ulps instead of epsilon
- assert on bad line results more often
git-svn-id: http://skia.googlecode.com/svn/trunk@8823 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pathops/SkDLineIntersection.cpp')
-rw-r--r-- | src/pathops/SkDLineIntersection.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/pathops/SkDLineIntersection.cpp b/src/pathops/SkDLineIntersection.cpp index 68e1f9e421..5fd7d61d7d 100644 --- a/src/pathops/SkDLineIntersection.cpp +++ b/src/pathops/SkDLineIntersection.cpp @@ -76,8 +76,7 @@ int SkIntersections::intersect(const SkDLine& a, const SkDLine& b) { axLen * (ay - ax * ayLen / axLen) == axLen * (by - bx * ayLen / axLen) axLen * ay - ax * ayLen == axLen * by - bx * ayLen */ - // FIXME: need to use AlmostEqualUlps variant instead - if (!approximately_equal_squared(axLen * a[0].fY - ayLen * a[0].fX, + if (!AlmostEqualUlps(axLen * a[0].fY - ayLen * a[0].fX, axLen * b[0].fY - ayLen * b[0].fX)) { return fUsed = 0; } @@ -154,7 +153,7 @@ int SkIntersections::horizontal(const SkDLine& line, double y) { int SkIntersections::horizontal(const SkDLine& line, double left, double right, double y) { int result = horizontal(line, y); if (result != 1) { - SkASSERT(result == 0); // FIXME: this is incorrect if result == 2 + SkASSERT(0); return result; } double xIntercept = line[0].fX + fT[0][0] * (line[1].fX - line[0].fX); @@ -258,7 +257,6 @@ int SkIntersections::vertical(const SkDLine& line, double top, double bottom, bool second = fabs(fT[0][0] - fT[0][1]) > FLT_EPSILON; SkASSERT((fabs(fT[1][0] - fT[1][1]) <= FLT_EPSILON) ^ second); return computePoints(line, 1 + second); - break; } if (flipped) { // OPTIMIZATION: instead of swapping, pass original line, use [1].fY - [0].fY |