From: egdaniel Date: Fri, 6 Jun 2014 14:47:17 +0000 (-0700) Subject: Revert of Fix Assert for gpu ConicalTwoPointGradient edgecase to be correct bounds... X-Git-Tag: submit/tizen/20180928.044319~7328 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97724ed4cf5ee29bb6020e50348a84cd2a3bf920;p=platform%2Fupstream%2FlibSkiaSharp.git Revert of Fix Assert for gpu ConicalTwoPointGradient edgecase to be correct bounds. (https://codereview.chromium.org/311373003/) Reason for revert: changed assert is failing Original issue's description: > Fix Assert for gpu ConicalTwoPointGradient edgecase to be correct bounds. > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/be4fd4f7349b97a7c34a4177ec26d8aea9616628 R=bsalomon@google.com TBR=bsalomon@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: egdaniel@google.com Review URL: https://codereview.chromium.org/320573002 --- diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp index ef244a2f65..23fee850f5 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp @@ -16,7 +16,6 @@ typedef GrGLUniformManager::UniformHandle UniformHandle; static const SkScalar kErrorTol = 0.00001f; -static const SkScalar kEdgeErrorTol = 5.f * kErrorTol; /** * We have three general cases for 2pt conical gradients. First we always assume that @@ -97,8 +96,7 @@ private: fRadius0(shader.getStartRadius()), fDiffRadius(shader.getDiffRadius()){ // We should only be calling this shader if we are degenerate case with touching circles - SkASSERT(SkScalarAbs(SkScalarAbs(fDiffRadius) - SkScalarAbs(fCenterX1)) < - fRadius0 * kEdgeErrorTol); + SkASSERT(SkScalarAbs(fDiffRadius) - SkScalarAbs(fCenterX1) < kErrorTol) ; // We pass the linear part of the quadratic as a varying. // float b = -2.0 * (fCenterX1 * x + fRadius0 * fDiffRadius * z) @@ -330,9 +328,9 @@ static ConicalType set_matrix_focal_conical(const SkTwoPointConicalGradient& sha // If the focal point is touching the edge of the circle it will // cause a degenerate case that must be handled separately - // kEdgeErrorTol = 5 * kErrorTol was picked after manual testing the - // stability trade off versus the linear approx used in the Edge Shader - if (SkScalarAbs(1.f - (*focalX)) < kEdgeErrorTol) { + // 5 * kErrorTol was picked after manual testing the stability trade off + // versus the linear approx used in the Edge Shader + if (SkScalarAbs(1.f - (*focalX)) < 5 * kErrorTol) { return kEdge_ConicalType; } @@ -773,10 +771,9 @@ static ConicalType set_matrix_circle_conical(const SkTwoPointConicalGradient& sh // Check to see if start circle is inside end circle with edges touching. // If touching we return that it is of kEdge_ConicalType, and leave the matrix setting - // to the edge shader. kEdgeErrorTol = 5 * kErrorTol was picked after manual testing - // so that C = 1 / A is stable, and the linear approximation used in the Edge shader is - // still accurate. - if (SkScalarAbs(A) < kEdgeErrorTol) { + // to the edge shader. 5 * kErrorTol was picked after manual testing so that C = 1 / A + // is stable, and the linear approximation used in the Edge shader is still accurate. + if (SkScalarAbs(A) < 5 * kErrorTol) { return kEdge_ConicalType; }