| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkPathOpsCubic_DEFINED | 8 #ifndef SkPathOpsCubic_DEFINED |
| 9 #define SkPathOpsCubic_DEFINED | 9 #define SkPathOpsCubic_DEFINED |
| 10 | 10 |
| 11 #include "SkPath.h" |
| 11 #include "SkPathOpsPoint.h" | 12 #include "SkPathOpsPoint.h" |
| 12 #include "SkTDArray.h" | 13 #include "SkTDArray.h" |
| 13 | 14 |
| 14 struct SkDCubicPair { | 15 struct SkDCubicPair { |
| 15 const SkDCubic& first() const { return (const SkDCubic&) pts[0]; } | 16 const SkDCubic& first() const { return (const SkDCubic&) pts[0]; } |
| 16 const SkDCubic& second() const { return (const SkDCubic&) pts[3]; } | 17 const SkDCubic& second() const { return (const SkDCubic&) pts[3]; } |
| 17 SkDPoint pts[7]; | 18 SkDPoint pts[7]; |
| 18 }; | 19 }; |
| 19 | 20 |
| 20 struct SkDCubic { | 21 struct SkDCubic { |
| 21 SkDPoint fPts[4]; | 22 SkDPoint fPts[4]; |
| 22 | 23 |
| 23 void set(const SkPoint pts[4]) { | 24 void set(const SkPoint pts[4]) { |
| 24 fPts[0] = pts[0]; | 25 fPts[0] = pts[0]; |
| 25 fPts[1] = pts[1]; | 26 fPts[1] = pts[1]; |
| 26 fPts[2] = pts[2]; | 27 fPts[2] = pts[2]; |
| 27 fPts[3] = pts[3]; | 28 fPts[3] = pts[3]; |
| 28 } | 29 } |
| 29 | 30 |
| 30 static const int gPrecisionUnit; | 31 static const int gPrecisionUnit; |
| 31 | 32 |
| 32 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 4); return
fPts[n]; } | 33 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 4); return
fPts[n]; } |
| 33 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 4); return fPts[n]; } | 34 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 4); return fPts[n]; } |
| 34 | 35 |
| 36 void align(int endIndex, int ctrlIndex, SkDPoint* dstPt) const; |
| 35 double calcPrecision() const; | 37 double calcPrecision() const; |
| 36 SkDCubicPair chopAt(double t) const; | 38 SkDCubicPair chopAt(double t) const; |
| 37 bool clockwise() const; | 39 bool clockwise() const; |
| 38 static void Coefficients(const double* cubic, double* A, double* B, double*
C, double* D); | 40 static void Coefficients(const double* cubic, double* A, double* B, double*
C, double* D); |
| 39 bool controlsContainedByEnds() const; | 41 bool controlsContainedByEnds() const; |
| 40 SkDVector dxdyAtT(double t) const; | 42 SkDVector dxdyAtT(double t) const; |
| 41 bool endsAreExtremaInXOrY() const; | 43 bool endsAreExtremaInXOrY() const; |
| 42 static int FindExtrema(double a, double b, double c, double d, double tValue
[2]); | 44 static int FindExtrema(double a, double b, double c, double d, double tValue
[2]); |
| 43 int findInflections(double tValues[]) const; | 45 int findInflections(double tValues[]) const; |
| 44 | 46 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 71 cubic.subDivide(a, d, t1, t2, p); | 73 cubic.subDivide(a, d, t1, t2, p); |
| 72 } | 74 } |
| 73 | 75 |
| 74 SkDPoint top(double startT, double endT) const; | 76 SkDPoint top(double startT, double endT) const; |
| 75 void toQuadraticTs(double precision, SkTDArray<double>* ts) const; | 77 void toQuadraticTs(double precision, SkTDArray<double>* ts) const; |
| 76 SkDQuad toQuad() const; | 78 SkDQuad toQuad() const; |
| 77 SkDPoint xyAtT(double t) const; | 79 SkDPoint xyAtT(double t) const; |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 #endif | 82 #endif |
| OLD | NEW |