| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "GrPathUtils.h" | 10 #include "GrPathUtils.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 tol = gMinCurveTol; | 151 tol = gMinCurveTol; |
| 152 } | 152 } |
| 153 GrAssert(tol > 0); | 153 GrAssert(tol > 0); |
| 154 | 154 |
| 155 int pointCount = 0; | 155 int pointCount = 0; |
| 156 *subpaths = 1; | 156 *subpaths = 1; |
| 157 | 157 |
| 158 bool first = true; | 158 bool first = true; |
| 159 | 159 |
| 160 SkPath::Iter iter(path, false); | 160 SkPath::Iter iter(path, false); |
| 161 GrPathCmd cmd; | 161 SkPath::Verb verb; |
| 162 | 162 |
| 163 GrPoint pts[4]; | 163 GrPoint pts[4]; |
| 164 while ((cmd = (GrPathCmd)iter.next(pts)) != kEnd_PathCmd) { | 164 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { |
| 165 | 165 |
| 166 switch (cmd) { | 166 switch (verb) { |
| 167 case kLine_PathCmd: | 167 case SkPath::kLine_Verb: |
| 168 pointCount += 1; | 168 pointCount += 1; |
| 169 break; | 169 break; |
| 170 case kQuadratic_PathCmd: | 170 case SkPath::kQuad_Verb: |
| 171 pointCount += quadraticPointCount(pts, tol); | 171 pointCount += quadraticPointCount(pts, tol); |
| 172 break; | 172 break; |
| 173 case kCubic_PathCmd: | 173 case SkPath::kCubic_Verb: |
| 174 pointCount += cubicPointCount(pts, tol); | 174 pointCount += cubicPointCount(pts, tol); |
| 175 break; | 175 break; |
| 176 case kMove_PathCmd: | 176 case SkPath::kMove_Verb: |
| 177 pointCount += 1; | 177 pointCount += 1; |
| 178 if (!first) { | 178 if (!first) { |
| 179 ++(*subpaths); | 179 ++(*subpaths); |
| 180 } | 180 } |
| 181 break; | 181 break; |
| 182 default: | 182 default: |
| 183 break; | 183 break; |
| 184 } | 184 } |
| 185 first = false; | 185 first = false; |
| 186 } | 186 } |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 // base tolerance is 1 pixel. | 470 // base tolerance is 1 pixel. |
| 471 static const SkScalar kTolerance = SK_Scalar1; | 471 static const SkScalar kTolerance = SK_Scalar1; |
| 472 const SkScalar tolSqd = SkScalarSquare(SkScalarMul(tolScale, kTolerance)); | 472 const SkScalar tolSqd = SkScalarSquare(SkScalarMul(tolScale, kTolerance)); |
| 473 | 473 |
| 474 for (int i = 0; i < count; ++i) { | 474 for (int i = 0; i < count; ++i) { |
| 475 SkPoint* cubic = chopped + 3*i; | 475 SkPoint* cubic = chopped + 3*i; |
| 476 convert_noninflect_cubic_to_quads(cubic, tolSqd, constrainWithinTangents
, dir, quads); | 476 convert_noninflect_cubic_to_quads(cubic, tolSqd, constrainWithinTangents
, dir, quads); |
| 477 } | 477 } |
| 478 | 478 |
| 479 } | 479 } |
| OLD | NEW |