OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrPathUtils_DEFINED | 8 #ifndef GrPathUtils_DEFINED |
9 #define GrPathUtils_DEFINED | 9 #define GrPathUtils_DEFINED |
10 | 10 |
11 #include "SkRect.h" | 11 #include "SkRect.h" |
12 #include "SkPath.h" | 12 #include "SkPathPriv.h" |
13 #include "SkTArray.h" | 13 #include "SkTArray.h" |
14 | 14 |
15 class SkMatrix; | 15 class SkMatrix; |
16 | 16 |
17 /** | 17 /** |
18 * Utilities for evaluating paths. | 18 * Utilities for evaluating paths. |
19 */ | 19 */ |
20 namespace GrPathUtils { | 20 namespace GrPathUtils { |
21 SkScalar scaleToleranceToSrc(SkScalar devTol, | 21 SkScalar scaleToleranceToSrc(SkScalar devTol, |
22 const SkMatrix& viewM, | 22 const SkMatrix& viewM, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // ensure that the new control point lies between the lines ab and cd. The | 114 // ensure that the new control point lies between the lines ab and cd. The |
115 // convex path renderer requires this. It starts with a path where all the | 115 // convex path renderer requires this. It starts with a path where all the |
116 // control points taken together form a convex polygon. It relies on this | 116 // control points taken together form a convex polygon. It relies on this |
117 // property and the quadratic approximation of cubics step cannot alter it. | 117 // property and the quadratic approximation of cubics step cannot alter it. |
118 // Setting constrainWithinTangents to true enforces this property. When this | 118 // Setting constrainWithinTangents to true enforces this property. When this |
119 // is true the cubic must be simple and dir must specify the orientation of | 119 // is true the cubic must be simple and dir must specify the orientation of |
120 // the cubic. Otherwise, dir is ignored. | 120 // the cubic. Otherwise, dir is ignored. |
121 void convertCubicToQuads(const SkPoint p[4], | 121 void convertCubicToQuads(const SkPoint p[4], |
122 SkScalar tolScale, | 122 SkScalar tolScale, |
123 bool constrainWithinTangents, | 123 bool constrainWithinTangents, |
124 SkPath::Direction dir, | 124 SkPathPriv::FirstDirection dir, |
125 SkTArray<SkPoint, true>* quads); | 125 SkTArray<SkPoint, true>* quads); |
126 | 126 |
127 // Chops the cubic bezier passed in by src, at the double point (intersectio
n point) | 127 // Chops the cubic bezier passed in by src, at the double point (intersectio
n point) |
128 // if the curve is a cubic loop. If it is a loop, there will be two parametr
ic values for | 128 // if the curve is a cubic loop. If it is a loop, there will be two parametr
ic values for |
129 // the double point: ls and ms. We chop the cubic at these values if they ar
e between 0 and 1. | 129 // the double point: ls and ms. We chop the cubic at these values if they ar
e between 0 and 1. |
130 // Return value: | 130 // Return value: |
131 // Value of 3: ls and ms are both between (0,1), and dst will contain the th
ree cubics, | 131 // Value of 3: ls and ms are both between (0,1), and dst will contain the th
ree cubics, |
132 // dst[0..3], dst[3..6], and dst[6..9] if dst is not NULL | 132 // dst[0..3], dst[3..6], and dst[6..9] if dst is not NULL |
133 // Value of 2: Only one of ls and ms are between (0,1), and dst will contain
the two cubics, | 133 // Value of 2: Only one of ls and ms are between (0,1), and dst will contain
the two cubics, |
134 // dst[0..3] and dst[3..6] if dst is not NULL | 134 // dst[0..3] and dst[3..6] if dst is not NULL |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void getCubicKLM(const SkPoint p[4], SkScalar klm[9]); | 170 void getCubicKLM(const SkPoint p[4], SkScalar klm[9]); |
171 | 171 |
172 // When tessellating curved paths into linear segments, this defines the max
imum distance | 172 // When tessellating curved paths into linear segments, this defines the max
imum distance |
173 // in screen space which a segment may deviate from the mathmatically correc
t value. | 173 // in screen space which a segment may deviate from the mathmatically correc
t value. |
174 // Above this value, the segment will be subdivided. | 174 // Above this value, the segment will be subdivided. |
175 // This value was chosen to approximate the supersampling accuracy of the ra
ster path (16 | 175 // This value was chosen to approximate the supersampling accuracy of the ra
ster path (16 |
176 // samples, or one quarter pixel). | 176 // samples, or one quarter pixel). |
177 static const SkScalar kDefaultTolerance = SkDoubleToScalar(0.25); | 177 static const SkScalar kDefaultTolerance = SkDoubleToScalar(0.25); |
178 }; | 178 }; |
179 #endif | 179 #endif |
OLD | NEW |