| 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 #include "SkGeometry.h" | 7 #include "SkGeometry.h" |
| 8 #include "SkOpEdgeBuilder.h" | 8 #include "SkOpEdgeBuilder.h" |
| 9 #include "SkReduceOrder.h" | 9 #include "SkReduceOrder.h" |
| 10 | 10 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 SkPath::Verb v2 = SkReduceOrder::Cubic(&cubicPair[3], cStora
ge[1]); | 214 SkPath::Verb v2 = SkReduceOrder::Cubic(&cubicPair[3], cStora
ge[1]); |
| 215 if (v1 != SkPath::kMove_Verb && v2 != SkPath::kMove_Verb) { | 215 if (v1 != SkPath::kMove_Verb && v2 != SkPath::kMove_Verb) { |
| 216 SkPoint* curve1 = v1 == SkPath::kCubic_Verb ? &cubicPair
[0] : cStorage[0]; | 216 SkPoint* curve1 = v1 == SkPath::kCubic_Verb ? &cubicPair
[0] : cStorage[0]; |
| 217 SkPoint* curve2 = v2 == SkPath::kCubic_Verb ? &cubicPair
[3] : cStorage[1]; | 217 SkPoint* curve2 = v2 == SkPath::kCubic_Verb ? &cubicPair
[3] : cStorage[1]; |
| 218 for (int index = 0; index < SkPathOpsVerbToPoints(v1); +
+index) { | 218 for (int index = 0; index < SkPathOpsVerbToPoints(v1); +
+index) { |
| 219 force_small_to_zero(&curve1[index]); | 219 force_small_to_zero(&curve1[index]); |
| 220 } | 220 } |
| 221 for (int index = 0; index < SkPathOpsVerbToPoints(v2); +
+index) { | 221 for (int index = 0; index < SkPathOpsVerbToPoints(v2); +
+index) { |
| 222 force_small_to_zero(&curve2[index]); | 222 force_small_to_zero(&curve2[index]); |
| 223 } | 223 } |
| 224 fCurrentContour->addCurve(v1, curve1); | 224 if (SkPath::kLine_Verb != v1 || |
| 225 fCurrentContour->addCurve(v2, curve2); | 225 !SkDPoint::ApproximatelyEqual(curve1[0], curve1[
1])) { |
| 226 fCurrentContour->addCurve(v1, curve1); |
| 227 } |
| 228 if (SkPath::kLine_Verb != v2 || |
| 229 !SkDPoint::ApproximatelyEqual(curve2[0], curve2[
1])) { |
| 230 fCurrentContour->addCurve(v2, curve2); |
| 231 } |
| 226 } else { | 232 } else { |
| 227 fCurrentContour->addCubic(pointsPtr); | 233 fCurrentContour->addCubic(pointsPtr); |
| 228 } | 234 } |
| 229 } else { | 235 } else { |
| 230 fCurrentContour->addCubic(pointsPtr); | 236 fCurrentContour->addCubic(pointsPtr); |
| 231 } | 237 } |
| 232 } break; | 238 } break; |
| 233 case SkPath::kClose_Verb: | 239 case SkPath::kClose_Verb: |
| 234 SkASSERT(fCurrentContour); | 240 SkASSERT(fCurrentContour); |
| 235 if (!close()) { | 241 if (!close()) { |
| 236 return false; | 242 return false; |
| 237 } | 243 } |
| 238 continue; | 244 continue; |
| 239 default: | 245 default: |
| 240 SkDEBUGFAIL("bad verb"); | 246 SkDEBUGFAIL("bad verb"); |
| 241 return false; | 247 return false; |
| 242 } | 248 } |
| 243 SkASSERT(fCurrentContour); | 249 SkASSERT(fCurrentContour); |
| 244 fCurrentContour->debugValidate(); | 250 fCurrentContour->debugValidate(); |
| 245 pointsPtr += SkPathOpsVerbToPoints(verb); | 251 pointsPtr += SkPathOpsVerbToPoints(verb); |
| 246 } | 252 } |
| 247 if (fCurrentContour && fCurrentContour->count() &&!fAllowOpenContours && !clo
se()) { | 253 if (fCurrentContour && fCurrentContour->count() &&!fAllowOpenContours && !clo
se()) { |
| 248 return false; | 254 return false; |
| 249 } | 255 } |
| 250 return true; | 256 return true; |
| 251 } | 257 } |
| OLD | NEW |