diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkCubicClipper.cpp | 12 | ||||
-rw-r--r-- | src/core/SkCubicClipper.h | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/core/SkCubicClipper.cpp b/src/core/SkCubicClipper.cpp index d11eb9922f..6e47513fc3 100644 --- a/src/core/SkCubicClipper.cpp +++ b/src/core/SkCubicClipper.cpp @@ -77,7 +77,7 @@ static bool chopMonoCubicAtY(SkPoint pts[4], SkScalar y, SkScalar* t) { #else // BISECTION // Linear convergence, typically 16 iterations. // Check that the endpoints straddle zero. - SkScalar tNeg, tPos; // Parameter where the function is negative and positive, respectively. + SkScalar tNeg, tPos; // Negative and positive function parameters. if (ycrv[0] < 0) { if (ycrv[3] < 0) return false; @@ -92,7 +92,7 @@ static bool chopMonoCubicAtY(SkPoint pts[4], SkScalar y, SkScalar* t) { *t = 0; return true; } - + const SkScalar tol = SK_Scalar1 / 65536; // 1 for fixed, 1e-5 for float. int iters = 0; do { @@ -139,10 +139,10 @@ bool SkCubicClipper::clipCubic(const SkPoint srcPts[4], SkPoint dst[4]) { if (dst[3].fY <= ctop || dst[0].fY >= cbot) { return false; } - + SkScalar t; SkPoint tmp[7]; // for SkChopCubicAt - + // are we partially above if (dst[0].fY < ctop && chopMonoCubicAtY(dst, ctop, &t)) { SkChopCubicAt(dst, tmp, t); @@ -150,7 +150,7 @@ bool SkCubicClipper::clipCubic(const SkPoint srcPts[4], SkPoint dst[4]) { dst[1] = tmp[4]; dst[2] = tmp[5]; } - + // are we partially below if (dst[3].fY > cbot && chopMonoCubicAtY(dst, cbot, &t)) { SkChopCubicAt(dst, tmp, t); @@ -158,7 +158,7 @@ bool SkCubicClipper::clipCubic(const SkPoint srcPts[4], SkPoint dst[4]) { dst[2] = tmp[2]; dst[3] = tmp[3]; } - + if (reverse) { SkTSwap<SkPoint>(dst[0], dst[3]); SkTSwap<SkPoint>(dst[1], dst[2]); diff --git a/src/core/SkCubicClipper.h b/src/core/SkCubicClipper.h index 546abae8d4..9a45b3171d 100644 --- a/src/core/SkCubicClipper.h +++ b/src/core/SkCubicClipper.h @@ -22,14 +22,14 @@ /** This class is initialized with a clip rectangle, and then can be fed cubics, which must already be monotonic in Y. - + In the future, it might return a series of segments, allowing it to clip also in X, to ensure that all segments fit in a finite coordinate system. */ class SkCubicClipper { public: SkCubicClipper(); - + void setClip(const SkIRect& clip); bool clipCubic(const SkPoint src[4], SkPoint dst[4]); |