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 #include "GrPathUtils.h" | 8 #include "GrPathUtils.h" |
9 | 9 |
10 #include "GrTypes.h" | 10 #include "GrTypes.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 SkPath::Iter iter(path, false); | 159 SkPath::Iter iter(path, false); |
160 SkPath::Verb verb; | 160 SkPath::Verb verb; |
161 | 161 |
162 SkPoint pts[4]; | 162 SkPoint pts[4]; |
163 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { | 163 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { |
164 | 164 |
165 switch (verb) { | 165 switch (verb) { |
166 case SkPath::kLine_Verb: | 166 case SkPath::kLine_Verb: |
167 pointCount += 1; | 167 pointCount += 1; |
168 break; | 168 break; |
| 169 case SkPath::kConic_Verb: { |
| 170 SkScalar weight = iter.conicWeight(); |
| 171 SkAutoConicToQuads converter; |
| 172 const SkPoint* quadPts = converter.computeQuads(pts, weight, 0.2
5f); |
| 173 for (int i = 0; i < converter.countQuads(); ++i) { |
| 174 pointCount += quadraticPointCount(quadPts + 2*i, tol); |
| 175 } |
| 176 } |
169 case SkPath::kQuad_Verb: | 177 case SkPath::kQuad_Verb: |
170 pointCount += quadraticPointCount(pts, tol); | 178 pointCount += quadraticPointCount(pts, tol); |
171 break; | 179 break; |
172 case SkPath::kCubic_Verb: | 180 case SkPath::kCubic_Verb: |
173 pointCount += cubicPointCount(pts, tol); | 181 pointCount += cubicPointCount(pts, tol); |
174 break; | 182 break; |
175 case SkPath::kMove_Verb: | 183 case SkPath::kMove_Verb: |
176 pointCount += 1; | 184 pointCount += 1; |
177 if (!first) { | 185 if (!first) { |
178 ++(*subpaths); | 186 ++(*subpaths); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 set_loop_klm(d, controlK, controlL, controlM); | 798 set_loop_klm(d, controlK, controlL, controlM); |
791 } else if (kCusp_SkCubicType == cType) { | 799 } else if (kCusp_SkCubicType == cType) { |
792 SkASSERT(0.f == d[0]); | 800 SkASSERT(0.f == d[0]); |
793 set_cusp_klm(d, controlK, controlL, controlM); | 801 set_cusp_klm(d, controlK, controlL, controlM); |
794 } else if (kQuadratic_SkCubicType == cType) { | 802 } else if (kQuadratic_SkCubicType == cType) { |
795 set_quadratic_klm(d, controlK, controlL, controlM); | 803 set_quadratic_klm(d, controlK, controlL, controlM); |
796 } | 804 } |
797 | 805 |
798 calc_cubic_klm(p, controlK, controlL, controlM, klm, &klm[3], &klm[6]); | 806 calc_cubic_klm(p, controlK, controlL, controlM, klm, &klm[3], &klm[6]); |
799 } | 807 } |
OLD | NEW |