diff options
author | reed <reed@chromium.org> | 2015-05-05 07:49:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-05 07:49:56 -0700 |
commit | 7d3bdc3aa53ef953318db2611c51e0eef4ee4214 (patch) | |
tree | 720555efa24a717e1f615f4a70517bfc8dc1abea | |
parent | b5238a7571c243ba4a154a62575570c3078b3741 (diff) |
remove dead SK_SUPPORT_LEGACY_CUBIC_CHOPPER code
BUG=skia:
TBR=
Review URL: https://codereview.chromium.org/1116263005
-rw-r--r-- | src/core/SkEdgeClipper.cpp | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp index 87bfbb9b5c..96fac6121f 100644 --- a/src/core/SkEdgeClipper.cpp +++ b/src/core/SkEdgeClipper.cpp @@ -225,79 +225,18 @@ bool SkEdgeClipper::clipQuad(const SkPoint srcPts[3], const SkRect& clip) { /////////////////////////////////////////////////////////////////////////////// -#ifdef SK_SUPPORT_LEGACY_CUBIC_CHOPPER -static SkScalar eval_cubic_coeff(SkScalar A, SkScalar B, SkScalar C, - SkScalar D, SkScalar t) { - return SkScalarMulAdd(SkScalarMulAdd(SkScalarMulAdd(A, t, B), t, C), t, D); -} - -/* Given 4 cubic points (either Xs or Ys), and a target X or Y, compute the - t value such that cubic(t) = target - */ -static bool chopMonoCubicAt(SkScalar c0, SkScalar c1, SkScalar c2, SkScalar c3, - SkScalar target, SkScalar* t) { - // SkASSERT(c0 <= c1 && c1 <= c2 && c2 <= c3); - SkASSERT(c0 < target && target < c3); - - SkScalar D = c0 - target; - SkScalar A = c3 + 3*(c1 - c2) - c0; - SkScalar B = 3*(c2 - c1 - c1 + c0); - SkScalar C = 3*(c1 - c0); - - const SkScalar TOLERANCE = SK_Scalar1 / 4096; - SkScalar minT = 0; - SkScalar maxT = SK_Scalar1; - SkScalar mid; - - // This is a lot of iterations. Is there a faster way? - for (int i = 0; i < 24; i++) { - mid = SkScalarAve(minT, maxT); - SkScalar delta = eval_cubic_coeff(A, B, C, D, mid); - if (delta < 0) { - minT = mid; - delta = -delta; - } else { - maxT = mid; - } - if (delta < TOLERANCE) { - break; - } - } - *t = mid; -// SkDebugf("-- evalCubicAt %d delta %g\n", i, eval_cubic_coeff(A, B, C, D, *t)); - return true; -} - -static bool chopMonoCubicAtY(SkPoint pts[4], SkScalar y, SkScalar* t) { - return chopMonoCubicAt(pts[0].fY, pts[1].fY, pts[2].fY, pts[3].fY, y, t); -} - -static bool chopMonoCubicAtX(SkPoint pts[4], SkScalar x, SkScalar* t) { - return chopMonoCubicAt(pts[0].fX, pts[1].fX, pts[2].fX, pts[3].fX, x, t); -} -#endif - // Modify pts[] in place so that it is clipped in Y to the clip rect static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) { // are we partially above if (pts[0].fY < clip.fTop) { SkPoint tmp[7]; -#ifdef SK_SUPPORT_LEGACY_CUBIC_CHOPPER - SkScalar t; - if (chopMonoCubicAtY(pts, clip.fTop, &t)) { - SkChopCubicAt(pts, tmp, t); -#else if (SkChopMonoCubicAtY(pts, clip.fTop, tmp)) { -#endif // tmp[3, 4].fY should all be to the below clip.fTop. // Since we can't trust the numerics of // the chopper, we force those conditions now tmp[3].fY = clip.fTop; clamp_ge(tmp[4].fY, clip.fTop); -#ifdef SK_SUPPORT_LEGACY_CUBIC_CHOPPER - clamp_ge(tmp[5].fY, clip.fTop); -#endif pts[0] = tmp[3]; pts[1] = tmp[4]; @@ -314,13 +253,7 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) { // are we partially below if (pts[3].fY > clip.fBottom) { SkPoint tmp[7]; -#ifdef SK_SUPPORT_LEGACY_CUBIC_CHOPPER - SkScalar t; - if (chopMonoCubicAtY(pts, clip.fBottom, &t)) { - SkChopCubicAt(pts, tmp, t); -#else if (SkChopMonoCubicAtY(pts, clip.fBottom, tmp)) { -#endif tmp[3].fY = clip.fBottom; clamp_le(tmp[2].fY, clip.fBottom); @@ -372,13 +305,7 @@ void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) { // are we partially to the left if (pts[0].fX < clip.fLeft) { SkPoint tmp[7]; -#ifdef SK_SUPPORT_LEGACY_CUBIC_CHOPPER - SkScalar t; - if (chopMonoCubicAtX(pts, clip.fLeft, &t)) { - SkChopCubicAt(pts, tmp, t); -#else if (SkChopMonoCubicAtX(pts, clip.fLeft, tmp)) { -#endif this->appendVLine(clip.fLeft, tmp[0].fY, tmp[3].fY, reverse); // tmp[3, 4].fX should all be to the right of clip.fLeft. @@ -386,9 +313,6 @@ void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) { // the chopper, we force those conditions now tmp[3].fX = clip.fLeft; clamp_ge(tmp[4].fX, clip.fLeft); -#ifdef SK_SUPPORT_LEGACY_CUBIC_CHOPPER - clamp_ge(tmp[5].fX, clip.fLeft); -#endif pts[0] = tmp[3]; pts[1] = tmp[4]; @@ -404,18 +328,9 @@ void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) { // are we partially to the right if (pts[3].fX > clip.fRight) { SkPoint tmp[7]; -#ifdef SK_SUPPORT_LEGACY_CUBIC_CHOPPER - SkScalar t; - if (chopMonoCubicAtX(pts, clip.fRight, &t)) { - SkChopCubicAt(pts, tmp, t); -#else if (SkChopMonoCubicAtX(pts, clip.fRight, tmp)) { -#endif tmp[3].fX = clip.fRight; clamp_le(tmp[2].fX, clip.fRight); -#ifdef SK_SUPPORT_LEGACY_CUBIC_CHOPPER - clamp_le(tmp[1].fX, clip.fRight); -#endif this->appendCubic(tmp, reverse); this->appendVLine(clip.fRight, tmp[3].fY, tmp[6].fY, reverse); |