| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 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 "SkPathMeasure.h" | 10 #include "SkPathMeasure.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 static void seg_to(const SkPoint pts[], int segType, | 310 static void seg_to(const SkPoint pts[], int segType, |
| 311 SkScalar startT, SkScalar stopT, SkPath* dst) { | 311 SkScalar startT, SkScalar stopT, SkPath* dst) { |
| 312 SkASSERT(startT >= 0 && startT <= SK_Scalar1); | 312 SkASSERT(startT >= 0 && startT <= SK_Scalar1); |
| 313 SkASSERT(stopT >= 0 && stopT <= SK_Scalar1); | 313 SkASSERT(stopT >= 0 && stopT <= SK_Scalar1); |
| 314 SkASSERT(startT <= stopT); | 314 SkASSERT(startT <= stopT); |
| 315 | 315 |
| 316 if (startT == stopT) { | 316 if (startT == stopT) { |
| 317 return; // should we report this, to undo a moveTo? | 317 SkPoint lastPt; |
| 318 SkAssertResult(dst->getLastPt(&lastPt)); |
| 319 dst->lineTo(lastPt); |
| 320 return; |
| 318 } | 321 } |
| 319 | 322 |
| 320 SkPoint tmp0[7], tmp1[7]; | 323 SkPoint tmp0[7], tmp1[7]; |
| 321 | 324 |
| 322 switch (segType) { | 325 switch (segType) { |
| 323 case kLine_SegType: | 326 case kLine_SegType: |
| 324 if (SK_Scalar1 == stopT) { | 327 if (SK_Scalar1 == stopT) { |
| 325 dst->lineTo(pts[1]); | 328 dst->lineTo(pts[1]); |
| 326 } else { | 329 } else { |
| 327 dst->lineTo(SkScalarInterp(pts[0].fX, pts[1].fX, stopT), | 330 dst->lineTo(SkScalarInterp(pts[0].fX, pts[1].fX, stopT), |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 SkASSERT(dst); | 564 SkASSERT(dst); |
| 562 | 565 |
| 563 SkScalar length = this->getLength(); // ensure we have built our segments | 566 SkScalar length = this->getLength(); // ensure we have built our segments |
| 564 | 567 |
| 565 if (startD < 0) { | 568 if (startD < 0) { |
| 566 startD = 0; | 569 startD = 0; |
| 567 } | 570 } |
| 568 if (stopD > length) { | 571 if (stopD > length) { |
| 569 stopD = length; | 572 stopD = length; |
| 570 } | 573 } |
| 571 if (startD >= stopD) { | 574 if (startD > stopD) { |
| 572 return false; | 575 return false; |
| 573 } | 576 } |
| 574 | 577 |
| 575 SkPoint p; | 578 SkPoint p; |
| 576 SkScalar startT, stopT; | 579 SkScalar startT, stopT; |
| 577 const Segment* seg = this->distanceToSegment(startD, &startT); | 580 const Segment* seg = this->distanceToSegment(startD, &startT); |
| 578 const Segment* stopSeg = this->distanceToSegment(stopD, &stopT); | 581 const Segment* stopSeg = this->distanceToSegment(stopD, &stopT); |
| 579 SkASSERT(seg <= stopSeg); | 582 SkASSERT(seg <= stopSeg); |
| 580 | 583 |
| 581 if (startWithMoveTo) { | 584 if (startWithMoveTo) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 622 |
| 620 for (int i = 0; i < fSegments.count(); i++) { | 623 for (int i = 0; i < fSegments.count(); i++) { |
| 621 const Segment* seg = &fSegments[i]; | 624 const Segment* seg = &fSegments[i]; |
| 622 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", | 625 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", |
| 623 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), | 626 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), |
| 624 seg->fType); | 627 seg->fType); |
| 625 } | 628 } |
| 626 } | 629 } |
| 627 | 630 |
| 628 #endif | 631 #endif |
| OLD | NEW |