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 /* if the dash as a zero-length on segment, add a corresponding zero-len
gth line. |
| 318 The stroke code will add end caps to zero length lines as appropriate
*/ |
| 319 SkPoint lastPt; |
| 320 SkAssertResult(dst->getLastPt(&lastPt)); |
| 321 dst->lineTo(lastPt); |
| 322 return; |
318 } | 323 } |
319 | 324 |
320 SkPoint tmp0[7], tmp1[7]; | 325 SkPoint tmp0[7], tmp1[7]; |
321 | 326 |
322 switch (segType) { | 327 switch (segType) { |
323 case kLine_SegType: | 328 case kLine_SegType: |
324 if (SK_Scalar1 == stopT) { | 329 if (SK_Scalar1 == stopT) { |
325 dst->lineTo(pts[1]); | 330 dst->lineTo(pts[1]); |
326 } else { | 331 } else { |
327 dst->lineTo(SkScalarInterp(pts[0].fX, pts[1].fX, stopT), | 332 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); | 566 SkASSERT(dst); |
562 | 567 |
563 SkScalar length = this->getLength(); // ensure we have built our segments | 568 SkScalar length = this->getLength(); // ensure we have built our segments |
564 | 569 |
565 if (startD < 0) { | 570 if (startD < 0) { |
566 startD = 0; | 571 startD = 0; |
567 } | 572 } |
568 if (stopD > length) { | 573 if (stopD > length) { |
569 stopD = length; | 574 stopD = length; |
570 } | 575 } |
571 if (startD >= stopD) { | 576 if (startD > stopD) { |
572 return false; | 577 return false; |
573 } | 578 } |
574 | 579 |
575 SkPoint p; | 580 SkPoint p; |
576 SkScalar startT, stopT; | 581 SkScalar startT, stopT; |
577 const Segment* seg = this->distanceToSegment(startD, &startT); | 582 const Segment* seg = this->distanceToSegment(startD, &startT); |
578 const Segment* stopSeg = this->distanceToSegment(stopD, &stopT); | 583 const Segment* stopSeg = this->distanceToSegment(stopD, &stopT); |
579 SkASSERT(seg <= stopSeg); | 584 SkASSERT(seg <= stopSeg); |
580 | 585 |
581 if (startWithMoveTo) { | 586 if (startWithMoveTo) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 624 |
620 for (int i = 0; i < fSegments.count(); i++) { | 625 for (int i = 0; i < fSegments.count(); i++) { |
621 const Segment* seg = &fSegments[i]; | 626 const Segment* seg = &fSegments[i]; |
622 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", | 627 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", |
623 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), | 628 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), |
624 seg->fType); | 629 seg->fType); |
625 } | 630 } |
626 } | 631 } |
627 | 632 |
628 #endif | 633 #endif |
OLD | NEW |