| Index: src/utils/SkCurveMeasure.h
|
| diff --git a/src/utils/SkCurveMeasure.h b/src/utils/SkCurveMeasure.h
|
| index 5807211236efbe96d146eff421f096e5697e7957..eaf779db8de7883343e67d50dcb4a87199ab06a2 100644
|
| --- a/src/utils/SkCurveMeasure.h
|
| +++ b/src/utils/SkCurveMeasure.h
|
| @@ -14,18 +14,26 @@
|
|
|
| // These are weights and abscissae for gaussian quadrature with weight function
|
| // w(x) = 1
|
| -static SkScalar weights8[8] = {0.3626837833783620f, 0.3626837833783620f,
|
| - 0.3137066458778873f, 0.3137066458778873f,
|
| - 0.2223810344533745f, 0.2223810344533745f,
|
| - 0.1012285362903763f, 0.1012285362903763f};
|
| -static SkScalar absc8[8] = {-0.1834346424956498f, 0.1834346424956498f,
|
| - -0.5255324099163290f, 0.5255324099163290f,
|
| - -0.7966664774136267f, 0.7966664774136267f,
|
| - -0.9602898564975363f, 0.9602898564975363f};
|
| +static const SkScalar weights8[8] = {0.3626837833783620f, 0.3626837833783620f,
|
| + 0.3137066458778873f, 0.3137066458778873f,
|
| + 0.2223810344533745f, 0.2223810344533745f,
|
| + 0.1012285362903763f, 0.1012285362903763f};
|
| +static const SkScalar absc8[8] = {-0.1834346424956498f, 0.1834346424956498f,
|
| + -0.5255324099163290f, 0.5255324099163290f,
|
| + -0.7966664774136267f, 0.7966664774136267f,
|
| + -0.9602898564975363f, 0.9602898564975363f};
|
|
|
| -static Sk8f weights = Sk8f::Load(weights8);
|
| -static Sk8f absc = 0.5f*(Sk8f::Load(absc8) + 1.0f);
|
| +static const Sk8f weights = Sk8f::Load(weights8);
|
| +static const Sk8f absc = 0.5f*(Sk8f::Load(absc8) + 1.0f);
|
|
|
| +/* Currently this uses Gaussian quadrature with a fixed number of
|
| + * evaluation points (see above weights and abscissae) but in principle
|
| + * we could have a table of abscissae and weights and choose which to use
|
| + * based on an approximation of the max length of the curve.
|
| + *
|
| + * We should always use some power of 2 number of evaluation points so that
|
| + * the SkNx templates will compile down into SIMD-register-aligned blocks.
|
| + */
|
|
|
| class ArcLengthIntegrator {
|
| public:
|
| @@ -37,14 +45,14 @@ private:
|
| SkSegType fSegType;
|
|
|
| // precomputed coefficients for derivatives in Horner form
|
| - Sk8f xCoeff[3];
|
| - Sk8f yCoeff[3];
|
| + Sk8f fXCoeff[3];
|
| + Sk8f fYCoeff[3];
|
| +
|
| + SkScalar fConicW = 0;
|
| };
|
|
|
| class SkCurveMeasure {
|
| public:
|
| - SkCurveMeasure() {}
|
| -
|
| // Almost exactly the same as in SkPath::Iter:
|
| // kLine_SegType -> 2 points: start end
|
| // kQuad_SegType -> 3 points: start control end
|
| @@ -60,9 +68,9 @@ public:
|
| SkScalar getLength();
|
|
|
| private:
|
| - const SkScalar kTolerance = 0.0001f;
|
| - const int kNewtonIters = 5;
|
| - const int kBisectIters = 5;
|
| + static constexpr SkScalar kTolerance = 0.0001f;
|
| + static const int kNewtonIters = 5;
|
| + static const int kBisectIters = 5;
|
|
|
| SkSegType fSegType;
|
| SkPoint fPts[4];
|
|
|