Improve cubic KLM accuracy
Moves cubic root finding logic out of GrPathUtils and
PathOpsCubicIntersectionTest, and unifies it in SkGeometry.
"Normalizes" the homogeneous parameter values of the roots, rather
than the cubic inflection function. Does this normalization by
twiddling the exponents instead of division (which causes a loss of
precision).
Abandons the built-in derivatives in GrCubicEffect. These don't have
high enough precision on many mobile gpus. Instead we pass the KLM
matrix to the vertex shader via uniform, where we can use it to set up
new linear functionals from which the fragment shader can calculate
the gradient of the implicit function.
Bug: skia:4410
Change-Id: Ibd64e999520adc8cdef7803a492d3699995aef5a
Reviewed-on: https://skia-review.googlesource.com/19017
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index 66becf3..6eab71d 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -646,8 +646,7 @@
c[i] = cubic.fPts[i].asSkPoint();
}
SkScalar loopT[3];
- SkScalar d[4];
- SkCubicType cubicType = SkClassifyCubic(c, d);
+ SkCubicType cubicType = SkClassifyCubic(c);
int breaks = SkDCubic::ComplexBreak(c, loopT);
SkASSERT(breaks < 2);
if (breaks && cubicType == SkCubicType::kLoop) {