OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkPathMeasure_DEFINED | 8 #ifndef SkPathMeasure_DEFINED |
9 #define SkPathMeasure_DEFINED | 9 #define SkPathMeasure_DEFINED |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 const SkPath* fPath; | 87 const SkPath* fPath; |
88 SkScalar fTolerance; | 88 SkScalar fTolerance; |
89 SkScalar fLength; // relative to the current contour | 89 SkScalar fLength; // relative to the current contour |
90 int fFirstPtIndex; // relative to the current contour | 90 int fFirstPtIndex; // relative to the current contour |
91 bool fIsClosed; // relative to the current contour | 91 bool fIsClosed; // relative to the current contour |
92 bool fForceClosed; | 92 bool fForceClosed; |
93 | 93 |
94 struct Segment { | 94 struct Segment { |
95 SkScalar fDistance; // total distance up to this point | 95 SkScalar fDistance; // total distance up to this point |
96 unsigned fPtIndex; // index into the fPts array | 96 unsigned fPtIndex; // index into the fPts array |
97 #ifdef SK_SUPPORT_LEGACY_PATH_MEASURE_TVALUE | |
98 unsigned fTValue : 15; | |
99 #else | |
100 unsigned fTValue : 30; | 97 unsigned fTValue : 30; |
101 #endif | |
102 unsigned fType : 2; | 98 unsigned fType : 2; |
103 | 99 |
104 SkScalar getScalarT() const; | 100 SkScalar getScalarT() const; |
105 }; | 101 }; |
106 SkTDArray<Segment> fSegments; | 102 SkTDArray<Segment> fSegments; |
107 SkTDArray<SkPoint> fPts; // Points used to define the segments | 103 SkTDArray<SkPoint> fPts; // Points used to define the segments |
108 | 104 |
109 static const Segment* NextSegment(const Segment*); | 105 static const Segment* NextSegment(const Segment*); |
110 | 106 |
111 void buildSegments(); | 107 void buildSegments(); |
112 SkScalar compute_quad_segs(const SkPoint pts[3], SkScalar distance, | 108 SkScalar compute_quad_segs(const SkPoint pts[3], SkScalar distance, |
113 int mint, int maxt, int ptIndex); | 109 int mint, int maxt, int ptIndex); |
114 #ifdef SK_SUPPORT_LEGACY_CONIC_MEASURE | |
115 SkScalar compute_conic_segs(const SkConic&, SkScalar distance, int mint, int
maxt, int ptIndex); | |
116 #else | |
117 SkScalar compute_conic_segs(const SkConic&, SkScalar distance, | 110 SkScalar compute_conic_segs(const SkConic&, SkScalar distance, |
118 int mint, const SkPoint& minPt, | 111 int mint, const SkPoint& minPt, |
119 int maxt, const SkPoint& maxPt, int ptIndex); | 112 int maxt, const SkPoint& maxPt, int ptIndex); |
120 #endif | |
121 SkScalar compute_cubic_segs(const SkPoint pts[3], SkScalar distance, | 113 SkScalar compute_cubic_segs(const SkPoint pts[3], SkScalar distance, |
122 int mint, int maxt, int ptIndex); | 114 int mint, int maxt, int ptIndex); |
123 const Segment* distanceToSegment(SkScalar distance, SkScalar* t); | 115 const Segment* distanceToSegment(SkScalar distance, SkScalar* t); |
124 bool quad_too_curvy(const SkPoint pts[3]); | 116 bool quad_too_curvy(const SkPoint pts[3]); |
125 #ifndef SK_SUPPORT_LEGACY_CONIC_MEASURE | |
126 bool conic_too_curvy(const SkPoint& firstPt, const SkPoint& midTPt,const SkP
oint& lastPt); | 117 bool conic_too_curvy(const SkPoint& firstPt, const SkPoint& midTPt,const SkP
oint& lastPt); |
127 #endif | |
128 bool cheap_dist_exceeds_limit(const SkPoint& pt, SkScalar x, SkScalar y); | 118 bool cheap_dist_exceeds_limit(const SkPoint& pt, SkScalar x, SkScalar y); |
129 bool cubic_too_curvy(const SkPoint pts[4]); | 119 bool cubic_too_curvy(const SkPoint pts[4]); |
130 }; | 120 }; |
131 | 121 |
132 #endif | 122 #endif |
OLD | NEW |